BerriAI/litellm · error · ValueError

Video generation failed: {failure_reason}

Error message

Video generation failed: {failure_reason}

What it means

Terminal-state guard while extracting a video URL: the output field is empty and the task status is FAILED, so the failure reason from the task payload is raised instead of a misleading 'no URL' error.

Source

Thrown at litellm/llms/runwayml/videos/transformation.py:376

    def _extract_video_url_from_response(self, response_data: dict[str, Any]) -> str:
        """
        Helper method to extract video URL from RunwayML response.
        Shared between sync and async transforms.
        """
        # Extract video URL from the output field
        video_url = None
        if "output" in response_data and response_data["output"]:
            output: Final = response_data["output"]
            video_url = output[0] if isinstance(output, list) else output

        if not video_url:
            # Check if the video generation failed or is still processing
            status: Final = response_data.get("status", "UNKNOWN")
            if status in ["PENDING", "RUNNING", "THROTTLED"]:
                raise ValueError(f"Video is still processing (status: {status}). Please wait and try again.")
            elif status == "FAILED":
                failure_reason: Final = response_data.get("failure", "Unknown error")
                raise ValueError(f"Video generation failed: {failure_reason}")
            else:
                raise ValueError("Video URL not found in response. Video may not be ready yet.")

        return video_url

    def transform_video_content_response(
        self,
        raw_response: httpx.Response,
        logging_obj: LiteLLMLoggingObj,
    ) -> bytes:
        """
        Transform the RunwayML video content download response (synchronous).

        RunwayML's task endpoint returns JSON with a video URL in the output field.
        We need to extract the URL and download the video.

        Example response:
        {

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Read failure_reason to identify the cause.
  2. Adjust prompt or parameters to comply with RunwayML constraints.

Example fix

# check the failed task in the RunwayML dashboard.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when a RunwayML video 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/a3fb9d9f904167ae. Report an issue: GitHub.