{"record":{"id":"33aa1898e8b3ceed","repo":"affaan-m/ECC","slug":"stage-label-failed-with-exit-proc-returncode","errorCode":null,"errorMessage":"stage '{label}' failed with exit {proc.returncode}","messagePattern":"stage '(.+?)' failed with exit (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/pipeline.py","lineNumber":48,"sourceCode":"import sys\nimport time\nfrom pathlib import Path\n\n\nSCRIPTS = Path(__file__).resolve().parent\n\n\ndef _command(cmd: list[str]) -> list[str]:\n    \"\"\"Resolve tools, while retaining caller-relative media and output paths.\"\"\"\n    return [sys.executable, str(SCRIPTS / cmd[0]), *cmd[1:]]\n\n\ndef _run(label: str, cmd: list[str]) -> None:\n    print(f\"\\n{'=' * 70}\\n[{label}] {' '.join(cmd[:6])} ...\\n{'=' * 70}\")\n    t = time.time()\n    proc = subprocess.run(_command(cmd))\n    if proc.returncode != 0:\n        raise SystemExit(f\"stage '{label}' failed with exit {proc.returncode}\")\n    print(f\"[{label}] done in {time.time() - t:.0f}s\")\n\n\ndef main() -> None:\n    ap = argparse.ArgumentParser(description=\"Run the full taste-forge chain.\")\n    ap.add_argument(\"--genre\", required=True)\n    ap.add_argument(\"--refs\", nargs=\"*\", default=None,\n                    help=\"reference videos; omit to reuse an existing pack\")\n    ap.add_argument(\"--takes\", nargs=\"+\", help=\"existing local takes; skips every provider stage\")\n    ap.add_argument(\"--fps\", type=float, default=None, help=\"output frame rate\")\n    ap.add_argument(\"--brief\", default=\"\", help=\"WHAT HAPPENS in the new piece\")\n    ap.add_argument(\"--style-steer\", default=\"\", help=\"HOW IT LOOKS, per-run nudge\")\n    ap.add_argument(\"--duration\", type=float, default=12.0,\n                    help=\"best-effort cadence target in seconds, not an exact duration; actual result is reported\")\n    ap.add_argument(\"--base-video\", default=None, help=\"existing footage to supplement\")\n    ap.add_argument(\"--base-ratio\", type=float, default=0.35)\n    ap.add_argument(\"--out\", default=None)\n    ap.add_argument(\"--root\", default=\"stylepacks\")","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/pipeline.py#L30-L66","documentation":"pipeline.py's _run wraps a subprocess stage of the full chain; when the child process exits non-zero it raises SystemExit with a message naming the stage label and exit code. It converts an arbitrary downstream tool failure into a uniform, labeled pipeline abort.","triggerScenarios":"Any wrapped stage script (mint.py, mint3d.py, forge.py, resolve_ingest.py, verify) exits non-zero - e.g. due to the other errors in this set: unreadable refs, existing outputs, missing stills, invalid names.","commonSituations":"Chained runs where an early stage fails and the pipeline halts with only 'stage X failed with exit N'; Python's default exit 1 from an uncaught exception in a stage, or exit 2 from a failed verify.","solutions":["Read the child stage's output printed just above the failure to find the root cause","Re-run only the failed stage directly to iterate faster and see full stderr","Fix the underlying stage-specific problem (missing refs, name collision, etc.) before rerunning the pipeline","Check exit code semantics: nonzero codes like 2 from verify indicate check failures rather than crashes"],"exampleFix":"// before\npython pipeline.py --genre noir --refs ref.mp4   # stage 'mint' failed with exit 1\n// after\npython mint.py noir --refs ref.mp4   # run stage directly to see full error, then rerun pipeline","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    pipeline.main()\nexcept SystemExit as e:\n    m = re.search(r\"stage '(\\w+)' failed with exit (\\d+)\", str(e))\n    if m:\n        stage, code = m.groups()\n        rerun_stage_directly(stage)  # see full stderr there","preventionTips":["Run each stage standalone first when debugging","Always read the child stage output above the failure line","Fix stage-level root causes instead of retrying the whole pipeline"],"tags":["subprocess","pipeline","exit-code"],"backgroundTag":"command-failed","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}