harry0703/MoneyPrinterTurbo · error · SoniloError
Sonilo returned no audio data
Error message
Sonilo returned no audio data
What it means
Raised when the stream ended cleanly (a complete event was received) but zero audio bytes were accumulated. The protocol was honored yet the provider delivered a finished, empty result. It is separated from error 93 to distinguish a truncated stream from a legitimate-but-empty generation, typically a server-side failure that still emits complete.
Source
Thrown at app/services/sonilo.py:267
if not isinstance(encoded_chunk, str) or not encoded_chunk:
raise SoniloError("Sonilo returned an empty audio chunk")
try:
chunk = base64.b64decode(encoded_chunk, validate=True)
except (binascii.Error, ValueError) as exc:
raise SoniloError("Sonilo returned an invalid audio chunk") from exc
if not chunk:
raise SoniloError("Sonilo returned an empty audio chunk")
total_bytes += len(chunk)
if total_bytes > MAX_GENERATED_AUDIO_BYTES:
raise SoniloError("Sonilo audio exceeds the 30 MB limit")
output.write(chunk)
output.flush()
os.fsync(output.fileno())
if not completed:
raise SoniloError("Sonilo stream ended before completion")
if total_bytes <= 0:
raise SoniloError("Sonilo returned no audio data")
return total_bytes, title
def _request_bgm(video_path: str, output_path: str, prompt: str) -> str:
"""请求配乐并在完整协议及音频校验通过后原子保存。"""
output_dir = os.path.dirname(os.path.abspath(output_path))
os.makedirs(output_dir, exist_ok=True)
descriptor, temp_audio_path = tempfile.mkstemp(
prefix=".sonilo-audio-",
suffix=Path(output_path).suffix or ".m4a",
dir=output_dir,
)
os.close(descriptor)
try:
logger.info(
f"requesting Sonilo background music: video={video_path}, "
f"prompt_provided={bool(prompt)}"
)View on GitHub (pinned to 1f9f19c202)
Solutions
- Retry the task once; an empty-but-complete result is frequently a transient provider fault.
- Check account credits and usage on the Sonilo dashboard for evidence the generation ever ran.
- Try a different source video or prompt to rule out content-triggered silent rejection.
- If reproducible, report to Sonilo support: complete with zero audio_chunk events violates their own protocol.
Defensive patterns
Strategy: retry
Try / catch
try:
audio = request_bgm(video, out, prompt)
except SoniloError as exc:
if "returned no audio data" in str(exc):
# complete-but-empty is usually a silent provider failure: retry once
retry_once()
raise Prevention
- Treat complete-with-zero-audio as a provider health signal; count occurrences and alert past a threshold.
- Never promote the empty temp file to the output path; the library already prevents this, keep callers from bypassing it.
When it happens
Trigger: The provider emits a complete event immediately (or after only title or meta events) because generation failed silently, the video was rejected after upload, or credits were exhausted without an error event; a server bug produces a zero-length result.
Common situations: Provider incidents where failures bypass the error channel; unsupported video content accepted at upload then skipped server-side; quota exhausted mid-request with a graceful-complete bug.
Related errors
- Sonilo generation failed: {message}
- Sonilo returned an empty audio chunk
- Sonilo audio exceeds the 30 MB limit
- Sonilo returned malformed streaming data
- Sonilo returned an invalid streaming event
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/921ad04550062f4a.
Report an issue: GitHub.