harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError
ElevenLabs music prompt exceeds 1000 characters
Error message
ElevenLabs music prompt exceeds 1000 characters
What it means
Prompt-length guard in generate_bgm: the stripped prompt exceeds MAX_PROMPT_LENGTH (1000 characters). Sent as form data alongside the video, an oversized prompt would be rejected by ElevenLabs after the whole video upload.
Source
Thrown at app/services/elevenlabs_music.py:388
if not get_api_key():
raise ElevenLabsMusicError("ElevenLabs API key is required")
if not os.path.isfile(video_path):
raise ElevenLabsMusicError("ElevenLabs input video does not exist")
try:
duration = float(video_duration)
except (TypeError, ValueError) as exc:
raise ElevenLabsMusicError(
"ElevenLabs video duration is invalid"
) from exc
if not math.isfinite(duration) or duration <= 0:
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
- Truncate or summarize the prompt to well under 1000 chars — a music style description rarely needs more than a few sentences
- If the prompt is LLM-generated, add a length constraint to the generation instruction
- Validate prompt length in the UI/task layer so the user gets feedback before render time
Example fix
# before music_prompt = full_video_script # thousands of chars generate_bgm(video, out, duration, music_prompt) # after music_prompt = full_video_script[:1000] if len(full_video_script) > 1000 else full_video_script generate_bgm(video, out, duration, music_prompt)
Defensive patterns
Strategy: validation
Validate before calling
from app.services.elevenlabs_music import MAX_PROMPT_LENGTH prompt = prompt.strip()[:MAX_PROMPT_LENGTH]
Prevention
- Keep music prompts to short style descriptions, not full scripts
- Enforce the 1000-char limit in the WebUI input field
When it happens
Trigger: generate_bgm called with a prompt whose .strip() length exceeds 1000 chars — typically a whole video description or concatenated per-scene prompts instead of a short style description.
Common situations: Reusing the full video script/subject text as the music prompt, LLM-generated prompts without a length budget, or prompts in CJK where token-to-char limits are easy to blow past.
Related errors
- ElevenLabs supports videos up to 600 seconds
- uploaded file must contain a decodable audio stream
- background music file is empty or missing
- background music file exceeds the 30 MB limit
- background music file is empty
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/8ef655595f6f0718.
Report an issue: GitHub.