BerriAI/litellm · error · ValueError

Failed to parse Bedrock batch response: {e}

Error message

Failed to parse Bedrock batch response: {e}

What it means

Error "Failed to parse Bedrock batch response: {e}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/bedrock/batches/transformation.py:273

            "url": endpoint_url,
            "headers": signed_headers,
            "data": signed_data.decode("utf-8"),
        }

    def transform_create_batch_response(
        self,
        model: str | None,
        raw_response: Response,
        logging_obj: Any,
        litellm_params: dict,
    ) -> LiteLLMBatch:
        """
        Transform Bedrock batch creation response to LiteLLM format.
        """
        try:
            response_data: Final[BedrockCreateBatchResponse] = raw_response.json()
        except Exception as e:
            raise ValueError(f"Failed to parse Bedrock batch response: {e}")

        # Extract information from typed Bedrock response
        job_arn: Final = response_data.get("jobArn", "")
        status_str: Final[str] = str(response_data.get("status", "Submitted"))

        # Map Bedrock status to OpenAI-compatible status
        status_mapping: Final[dict[str, str]] = {
            "Submitted": "validating",
            "Validating": "validating",
            "Scheduled": "in_progress",
            "InProgress": "in_progress",
            "PartiallyCompleted": "completed",
            "Completed": "completed",
            "Failed": "failed",
            "Stopping": "cancelling",
            "Stopped": "cancelled",
            "Expired": "expired",
        }

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Check the Bedrock batch response format; see the wrapped exception.

When it happens

Trigger: Thrown at litellm/llms/bedrock/batches/transformation.py:273 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/a45e1de319bdf1cd. Report an issue: GitHub.