{"record":{"id":"3f4d20f6cddf75b9","repo":"BerriAI/litellm","slug":"runwayml-image-generation-failed-failure-reason","errorCode":null,"errorMessage":"RunwayML image generation failed: {failure_reason} (code: {failure_code})","messagePattern":"RunwayML image generation failed: (.+?) \\(code: (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/runwayml/image_generation/transformation.py","lineNumber":180,"sourceCode":"        Args:\n            response_data: JSON response from RunwayML task endpoint\n\n        Returns:\n            Normalized status string: \"running\", \"succeeded\", or raises on failure\n\n        Raises:\n            ValueError: If task failed or status is unknown\n        \"\"\"\n        status: Final = response_data.get(\"status\", \"\").upper()\n\n        verbose_logger.debug(\"RunwayML task status: %s\", status)\n\n        if status == \"SUCCEEDED\":\n            return \"succeeded\"\n        elif status == \"FAILED\":\n            failure_reason: Final = response_data.get(\"failure\", \"Unknown error\")\n            failure_code: Final = response_data.get(\"failureCode\", \"unknown\")\n            raise ValueError(f\"RunwayML image generation failed: {failure_reason} (code: {failure_code})\")\n        elif status == \"CANCELLED\":\n            raise ValueError(\"RunwayML image generation was cancelled\")\n        elif status in [\"PENDING\", \"RUNNING\", \"THROTTLED\"]:\n            return \"running\"\n        else:\n            raise ValueError(f\"Unknown RunwayML task status: {status}\")\n\n    def _poll_task_sync(\n        self,\n        task_id: str,\n        api_base: str,\n        headers: dict[str, str],\n        timeout_secs: float = 600,\n    ) -> httpx.Response:\n        \"\"\"\n        Poll RunwayML task until completion (sync).\n\n        RunwayML POST returns immediately with a task that has status PENDING/RUNNING.","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/runwayml/image_generation/transformation.py#L162-L198","documentation":"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.","triggerScenarios":"Triggered when a RunwayML image generation task finishes with a failed status.","commonSituations":"See trigger scenarios.","solutions":["Read failure_reason/failure_code from the task result to identify the cause.","Adjust the prompt or parameters to comply with RunwayML content and input constraints."],"exampleFix":"# check the RunwayML dashboard for the failed task's details.","handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}