Skip to content

fix: detect demucs subprocess failure and missing output files#80

Open
octo-patch wants to merge 1 commit intoabus-aikorea:mainfrom
octo-patch:fix/issue-68-demucs-subprocess-error-handling
Open

fix: detect demucs subprocess failure and missing output files#80
octo-patch wants to merge 1 commit intoabus-aikorea:mainfrom
octo-patch:fix/issue-68-demucs-subprocess-error-handling

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #68

Problem

When demucs fails during stem separation (e.g. CUDA error, missing model files, or incorrect path), it exits with a non-zero return code, but the code continued silently. The next step — ffmpeg trying to read the non-existent vocals.wav / no_vocals.wav — then crashes with a cryptic error:

Error opening input file D:\voice-pro\workspace\demucs\htdemucs\a1\vocals.wav.
Error opening input files: No such file or directory
[WinError 3] 系统找不到指定的路径: 'D:\\voice-pro\\workspace\\demucs\\htdemucs\\a1\\no_vocals.wav'

The user sees the low-level OS error rather than any indication that demucs itself failed.

Solution

  • After the Popen context exits, check sp.returncode. If it is non-zero, raise a RuntimeError with a clear message pointing the user to the console output.
  • Add an os.path.exists guard on both expected output files before calling ffmpeg. If either file is missing (even when demucs returns 0), raise a FileNotFoundError with the output directory path so the user knows where to look.

Testing

Reviewed the demucs_split_file function and traced the error reported in the issue to the missing return-code check. The fix is minimal and does not change any logic paths when demucs succeeds.

…bus-aikorea#68)

When demucs fails (e.g. CUDA error, missing model files, or bad path),
the subprocess exits with a non-zero code but the code continued silently,
then crashed on a cryptic [WinError 3] / FileNotFoundError when ffmpeg
tried to read the non-existent output files.

Add an explicit returncode check immediately after the Popen context
exits, plus an os.path.exists guard on both expected output files, so
that failures surface with a clear error message before ffmpeg is called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error opening input: No such file or directory

1 participant