BerriAI/litellm · error · ValueError

RunwayML response missing task ID

Error message

RunwayML response missing task ID

What it means

Contract guard in the RunwayML image-generation response transformation: the JSON parsed fine but carries no 'id' field, so there is no task to poll for the generated image; the handler rejects the response rather than hanging.

Source

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

            "output": ["https://cloudfront.net/.../image.png"],
            "completedAt": "2025-11-13T..."
        }
        """
        try:
            response_data = raw_response.json()
        except Exception as e:
            raise self.get_error_class(
                error_message=f"Error transforming image generation response: {e}",
                status_code=raw_response.status_code,
                headers=raw_response.headers,
            )

        verbose_logger.debug("RunwayML starting polling...")

        # Get task ID
        task_id: Final = response_data.get("id")
        if not task_id:
            raise ValueError("RunwayML response missing task ID")

        # Get headers for polling (need auth)
        poll_headers: Final = {
            "Authorization": raw_response.request.headers.get("Authorization", ""),
            "X-Runway-Version": raw_response.request.headers.get("X-Runway-Version", RUNWAYML_DEFAULT_API_VERSION),
        }

        # Poll until task completes
        raw_response = self._poll_task_sync(
            task_id=task_id,
            api_base=self.DEFAULT_BASE_URL,
            headers=poll_headers,
            timeout_secs=RUNWAYML_POLLING_TIMEOUT,
        )

        # Update response_data with polled result
        response_data = raw_response.json()

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The RunwayML response lacked a task id; inspect the raw response.
  2. Verify the API key and request body against the RunwayML API docs.

Example fix

# log the response body from RunwayML to see the actual payload.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when the RunwayML image generation response does not contain a task ID.

Common situations: See trigger scenarios.


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