{"record":{"id":"6f39d0838f6a888a","repo":"calesthio/OpenMontage","slug":"name-failed-result-error","errorCode":null,"errorMessage":"{name} failed: {result.error}","messagePattern":"(.+?) failed: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/kling_official_animated_explainer_e2e.py","lineNumber":236,"sourceCode":"        \"kling_official_video\": {\n            \"prompt\": \"Slow camera push over a clean explainer visual.\",\n            \"operation\": \"image_to_video\",\n            \"api_family\": \"classic\",\n            \"model_name\": \"kling-v3\",\n            \"duration\": \"3\",\n            \"mode\": \"std\",\n            \"sound\": \"off\",\n        },\n    }\n    for name, payload in cases.items():\n        tool = registry.get(name)\n        dry[name] = tool.dry_run(payload) if tool else {\"status\": \"missing\"}\n    return dry\n\n\ndef _require_success(name: str, result: Any) -> None:\n    if not result.success:\n        raise RuntimeError(f\"{name} failed: {result.error}\")\n\n\ndef _aligned_video_duration(requested_duration: str, narration_seconds: float | None) -> str:\n    requested = int(requested_duration)\n    if narration_seconds:\n        requested = max(requested, int(math.ceil(narration_seconds)))\n    return str(min(max(requested, 3), 15))\n\n\ndef _announce_paid_call(tool: str, provider: str, model: str, reason: str, run_type: str) -> None:\n    print(f\"[paid:{run_type}] tool={tool} provider={provider} model={model}\")\n    print(f\"[paid:{run_type}] reason={reason}\")\n\n\ndef _run_live_tts(\n    project_dir: Path,\n    *,\n    voice_id: str,","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/scripts/kling_official_animated_explainer_e2e.py#L218-L254","documentation":"Raised by the _require_success assertion helper inside the Kling official animated-explainer E2E script. It fires when a tool invocation in the registry returns a result object whose `success` flag is falsy, and it embeds the tool name and the result's `error` payload verbatim. It is a fail-fast guard so the paid multi-step pipeline stops at the first failing stage instead of passing bad data downstream.","triggerScenarios":"Calling any registry tool (e.g. kling_official_image, kling_avatar, kling_lip_sync) via execute() with --live-full/--live-all/--live-sample modes in scripts/kling_official_animated_explainer_e2e.py; the underlying Kling API call fails (auth, quota, invalid payload, moderation rejection) and the result envelope comes back with success=False.","commonSituations":"KLING_API_KEY missing/expired or out of credits; a tool name absent from the registry in dry-run mode; prompt rejected by content moderation; rate limits hit mid-suite; network failure to the Kling API base URL.","solutions":["Read the embedded result.error payload — it is the upstream tool's failure reason and dictates the fix (e.g. 401 → set KLING_API_KEY, 429 → back off and rerun)","Rerun with the dry-run mode first (no --live flag) to validate payloads and registry wiring without spending credits","Verify KLING_API_KEY is exported in the environment and the account has quota for the announced paid call","If a specific stage keeps failing, isolate it with the matching --live-* flag instead of the full suite"],"exampleFix":"# before\n_require_success(\"kling_official_image\", portrait_result)\n\n# after (surface the failing stage before raising)\nif not portrait_result.success:\n    print(f\"stage diagnostics: {portrait_result}\")\n_require_success(\"kling_official_image\", portrait_result)","handlingStrategy":"try-catch","validationCode":"missing = [n for n, t in cases.items() if not registry.get(n)]\nif missing:\n    raise SystemExit(f\"tools not in registry: {missing}\")\n# for live calls, pre-check auth\nassert os.environ.get(\"KLING_API_KEY\"), \"KLING_API_KEY required for live runs\"","typeGuard":"def is_success(r: Any) -> bool:\n    return bool(getattr(r, \"success\", False))","tryCatchPattern":"try:\n    _require_success(name, result)\nexcept RuntimeError as e:\n    log.error(\"stage failed\", stage=name, error=getattr(result, \"error\", None))\n    raise SystemExit(1) from e  # fail fast, no silent retry of paid calls","preventionTips":["Run dry-run mode before any --live flag to validate payloads and registry wiring","Export KLING_API_KEY and confirm quota before paid suites","Treat any stage failure as terminal — partial reruns of paid pipelines waste credits"],"tags":["e2e","kling","api-client","fail-fast"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}