{"record":{"id":"59d4a8304fe633dd","repo":"babysor/MockingBird","slug":"no-segments-to-mix","errorCode":null,"errorMessage":"No segments to mix.","messagePattern":"No segments to mix\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/speak/scripts/render_timeline.py","lineNumber":184,"sourceCode":"    filters.append(f\"atempo={r:.6f}\")\n\n    _run_ff([\n        \"ffmpeg\", \"-y\", \"-i\", str(inp),\n        \"-af\", \",\".join(filters),\n        \"-t\", f\"{target_ms / 1000.0:.3f}\", str(outp),\n    ])\n\n\ndef delay_segment(inp: Path, outp: Path, start_ms: int) -> None:\n    _run_ff([\n        \"ffmpeg\", \"-y\", \"-i\", str(inp),\n        \"-af\", f\"adelay={start_ms}:all=1\", str(outp),\n    ])\n\n\ndef mix_all(inputs: List[Path], outp: Path, total_ms: int) -> None:\n    if not inputs:\n        raise ValueError(\"No segments to mix.\")\n    cmd = [\"ffmpeg\", \"-y\"]\n    for p in inputs:\n        cmd += [\"-i\", str(p)]\n    cmd += [\n        \"-filter_complex\",\n        f\"amix=inputs={len(inputs)}:duration=longest:dropout_transition=0\",\n        \"-t\", f\"{total_ms / 1000.0:.3f}\", str(outp),\n    ]\n    _run_ff(cmd)\n\n\n# ── Noiz backend ─────────────────────────────────────────────────────\n\n\ndef _noiz_emotion_enhance(\n    base_url: str, api_key: str, text: str, timeout: int\n) -> str:\n    import requests  # noqa: delayed import so kokoro path doesn't need requests","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/babysor/MockingBird/blob/28dc5e14f12d7c754612af2fde8e78a4b03f8616/skills/speak/scripts/render_timeline.py#L166-L202","documentation":"ValueError raised by mix_all when the list of input segment paths is empty. The final timeline mix needs at least one rendered segment to build an ffmpeg amix filter graph.","triggerScenarios":"All per-cue TTS segments failed or were filtered out before mixing, or parse_srt produced cues but synthesis yielded zero output files.","commonSituations":"A loop swallows per-cue synthesis errors and continues, leaving inputs empty; or a voice-map misconfiguration maps every cue to a skipped backend.","solutions":["Fail loudly on the first per-cue synthesis error instead of continuing with an empty list","Check why zero segments were produced (API failures, missing voices) before the mix step","Add a sanity check: if len(segments) != len(cues): warn"],"exampleFix":"# before\nmix_all(segments, out, total_ms)\n# after\nif not segments:\n    raise RuntimeError(\"all cue syntheses failed; see logs above\")\nmix_all(segments, out, total_ms)","handlingStrategy":"validation","validationCode":"assert segments, 'no segments produced; check per-cue logs'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Abort on first cue failure instead of collecting nothing","Compare len(segments) to len(cues) before mix","Log skipped cues explicitly"],"tags":["audio","mixing","validation","rendering"],"backgroundTag":"empty-input","analyzedSha":"28dc5e14f12d7c754612af2fde8e78a4b03f8616","analyzedAt":"2026-08-27T02:26:53.589Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}