harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError
ElevenLabs local file operation failed: {exc}
Error message
ElevenLabs local file operation failed: {exc} What it means
Catch-all in generate_bgm for OSError raised outside the HTTP call — i.e. during _create_video_proxy (FFmpeg re-encode to a <=200MB proxy) or file moves. ElevenLabsMusicError is re-raised untouched; only raw OS-level failures get wrapped with the underlying exc text.
Source
Thrown at app/services/elevenlabs_music.py:399
raise ElevenLabsMusicError("ElevenLabs video duration is invalid")
if duration > MAX_VIDEO_DURATION_SECONDS:
raise ElevenLabsMusicError(
"ElevenLabs supports videos up to 600 seconds"
)
prompt = str(prompt or "").strip()
if len(prompt) > MAX_PROMPT_LENGTH:
raise ElevenLabsMusicError(
"ElevenLabs music prompt exceeds 1000 characters"
)
proxy_path = ""
try:
proxy_path = _create_video_proxy(video_path)
return _request_bgm(proxy_path, output_path, prompt)
except ElevenLabsMusicError:
raise
except OSError as exc:
raise ElevenLabsMusicError(
f"ElevenLabs local file operation failed: {exc}"
) from exc
finally:
_remove_file(proxy_path)
View on GitHub (pinned to 1f9f19c202)
Solutions
- Check the embedded exc text: 'No such file or directory' with a subprocess usually means the ffmpeg binary is missing — install it or fix PATH
- Free space or point TMPDIR at a volume large enough for the proxy (up to 200MB) plus audio output
- Ensure output_path and temp dirs are on writable mounts
- Keep temp and output on the same filesystem so os.replace stays atomic
Example fix
# before
proxy_path = _create_video_proxy(video_path) # ENOSPC mid-encode, opaque
# after
import shutil
if shutil.disk_usage(tempfile.gettempdir()).free < 500 * 1024 * 1024:
raise OSError(f"insufficient temp space for proxy: {tempfile.gettempdir()}")
proxy_path = _create_video_proxy(video_path) Defensive patterns
Strategy: validation
Validate before calling
import shutil
assert shutil.which("ffmpeg"), "ffmpeg binary required for proxy creation"
assert os.access(os.path.dirname(output_path) or ".", os.W_OK) Try / catch
try:
elm.generate_bgm(...)
except elm.ElevenLabsMusicError as e:
if "local file operation" in str(e):
check_disk_and_paths() # surface ENOSPC/permission detail to ops
raise Prevention
- Install ffmpeg in the runtime image and keep PATH stable
- Ensure temp dir has >=200MB free per job
- Keep temp and output dirs on the same filesystem
When it happens
Trigger: FFmpeg subprocess spawn fails (binary not found), the proxy write hits ENOSPC (disk full), permission errors on temp/output directories, or os.replace across filesystems raising OSError.
Common situations: ffmpeg/ffprobe not installed or not on PATH in docker images, /tmp too small for a 200MB proxy of a long video, read-only output volume, or temp dir and output dir on different mounts.
Related errors
- {request_id}: background music validation is unavailable
- uploaded file must contain a decodable audio stream
- ElevenLabs video proxy generation timed out
- failed to run FFmpeg for ElevenLabs video proxy
- failed to generate ElevenLabs video proxy: {detail}
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/e320ba2e73efcc11.
Report an issue: GitHub.