fix: detect demucs subprocess failure and missing output files#80
Open
octo-patch wants to merge 1 commit intoabus-aikorea:mainfrom
Open
fix: detect demucs subprocess failure and missing output files#80octo-patch wants to merge 1 commit intoabus-aikorea:mainfrom
octo-patch wants to merge 1 commit intoabus-aikorea:mainfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:The user sees the low-level OS error rather than any indication that demucs itself failed.
Solution
Popencontext exits, checksp.returncode. If it is non-zero, raise aRuntimeErrorwith a clear message pointing the user to the console output.os.path.existsguard on both expected output files before calling ffmpeg. If either file is missing (even when demucs returns 0), raise aFileNotFoundErrorwith the output directory path so the user knows where to look.Testing
Reviewed the
demucs_split_filefunction 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.