calesthio/OpenMontage · error · RuntimeError

{name} failed: {result.error}

Error message

{name} failed: {result.error}

What it means

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.

Source

Thrown at scripts/kling_official_animated_explainer_e2e.py:236

        "kling_official_video": {
            "prompt": "Slow camera push over a clean explainer visual.",
            "operation": "image_to_video",
            "api_family": "classic",
            "model_name": "kling-v3",
            "duration": "3",
            "mode": "std",
            "sound": "off",
        },
    }
    for name, payload in cases.items():
        tool = registry.get(name)
        dry[name] = tool.dry_run(payload) if tool else {"status": "missing"}
    return dry


def _require_success(name: str, result: Any) -> None:
    if not result.success:
        raise RuntimeError(f"{name} failed: {result.error}")


def _aligned_video_duration(requested_duration: str, narration_seconds: float | None) -> str:
    requested = int(requested_duration)
    if narration_seconds:
        requested = max(requested, int(math.ceil(narration_seconds)))
    return str(min(max(requested, 3), 15))


def _announce_paid_call(tool: str, provider: str, model: str, reason: str, run_type: str) -> None:
    print(f"[paid:{run_type}] tool={tool} provider={provider} model={model}")
    print(f"[paid:{run_type}] reason={reason}")


def _run_live_tts(
    project_dir: Path,
    *,
    voice_id: str,

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. 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)
  2. Rerun with the dry-run mode first (no --live flag) to validate payloads and registry wiring without spending credits
  3. Verify KLING_API_KEY is exported in the environment and the account has quota for the announced paid call
  4. If a specific stage keeps failing, isolate it with the matching --live-* flag instead of the full suite

Example fix

# before
_require_success("kling_official_image", portrait_result)

# after (surface the failing stage before raising)
if not portrait_result.success:
    print(f"stage diagnostics: {portrait_result}")
_require_success("kling_official_image", portrait_result)
Defensive patterns

Strategy: try-catch

Validate before calling

missing = [n for n, t in cases.items() if not registry.get(n)]
if missing:
    raise SystemExit(f"tools not in registry: {missing}")
# for live calls, pre-check auth
assert os.environ.get("KLING_API_KEY"), "KLING_API_KEY required for live runs"

Type guard

def is_success(r: Any) -> bool:
    return bool(getattr(r, "success", False))

Try / catch

try:
    _require_success(name, result)
except RuntimeError as e:
    log.error("stage failed", stage=name, error=getattr(result, "error", None))
    raise SystemExit(1) from e  # fail fast, no silent retry of paid calls

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/6f39d0838f6a888a. Report an issue: GitHub.