From 6488df68d226bcb3a5541edce52eac9cb411f216 Mon Sep 17 00:00:00 2001 From: tjc66666666 <3428979959@qq.com> Date: Wed, 3 Jun 2026 02:00:39 +0800 Subject: [PATCH] Add check for audio file existence Handle case where audio file may not exist yet. --- astrbot/core/utils/media_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/astrbot/core/utils/media_utils.py b/astrbot/core/utils/media_utils.py index 3be1cadc16..8bd229c452 100644 --- a/astrbot/core/utils/media_utils.py +++ b/astrbot/core/utils/media_utils.py @@ -251,6 +251,11 @@ async def ensure_wav(audio_path: str, output_path: str | None = None) -> str: if not audio_path: return audio_path + if not os.path.exists(audio_path): + # File not available yet (e.g. napcat race condition); + # return the path as-is so upstream retry logic can handle it later. + return audio_path + audio_type = _get_audio_magic_type(audio_path) if audio_type == "wav": return audio_path