BerriAI/litellm · error · ValueError

RunwayML image generation failed: {failure_reason} (code: {f

Error message

RunwayML image generation failed: {failure_reason} (code: {failure_code})

What it means

Terminal-state mapping in RunwayML status normalization: the task ended FAILED, and the response's failure reason plus failureCode are surfaced in the ValueError so the caller knows why generation failed.

Source

Thrown at litellm/llms/runwayml/image_generation/transformation.py:180

        Args:
            response_data: JSON response from RunwayML task endpoint

        Returns:
            Normalized status string: "running", "succeeded", or raises on failure

        Raises:
            ValueError: If task failed or status is unknown
        """
        status: Final = response_data.get("status", "").upper()

        verbose_logger.debug("RunwayML task status: %s", status)

        if status == "SUCCEEDED":
            return "succeeded"
        elif status == "FAILED":
            failure_reason: Final = response_data.get("failure", "Unknown error")
            failure_code: Final = response_data.get("failureCode", "unknown")
            raise ValueError(f"RunwayML image generation failed: {failure_reason} (code: {failure_code})")
        elif status == "CANCELLED":
            raise ValueError("RunwayML image generation was cancelled")
        elif status in ["PENDING", "RUNNING", "THROTTLED"]:
            return "running"
        else:
            raise ValueError(f"Unknown RunwayML task status: {status}")

    def _poll_task_sync(
        self,
        task_id: str,
        api_base: str,
        headers: dict[str, str],
        timeout_secs: float = 600,
    ) -> httpx.Response:
        """
        Poll RunwayML task until completion (sync).

        RunwayML POST returns immediately with a task that has status PENDING/RUNNING.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Read failure_reason/failure_code from the task result to identify the cause.
  2. Adjust the prompt or parameters to comply with RunwayML content and input constraints.

Example fix

# check the RunwayML dashboard for the failed task's details.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when a RunwayML image generation task finishes with a failed status.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/3f4d20f6cddf75b9. Report an issue: GitHub.