BerriAI/litellm · error · A2AError

Failed to parse A2A response: {e}

Error message

Failed to parse A2A response: {e}

What it means

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

Source

Thrown at litellm/llms/a2a/chat/transformation.py:280

            model: Model name
            raw_response: HTTP response from A2A agent
            model_response: Model response object to populate
            logging_obj: Logging object
            request_data: Original request data
            messages: Original messages
            optional_params: Optional parameters
            litellm_params: LiteLLM parameters
            encoding: Encoding object
            api_key: API key
            json_mode: JSON mode flag

        Returns:
            Populated ModelResponse object
        """
        try:
            response_json: Final = raw_response.json()
        except Exception as e:
            raise A2AError(
                status_code=raw_response.status_code,
                message=f"Failed to parse A2A response: {e}",
                headers=dict(raw_response.headers),
            )

        # Check for JSON-RPC error
        if "error" in response_json:
            error: Final = response_json["error"]
            raise A2AError(
                status_code=raw_response.status_code,
                message=f"A2A error: {error.get('message', 'Unknown error')}",
                headers=dict(raw_response.headers),
            )

        # Extract text from A2A response
        text: Final = extract_text_from_a2a_response(response_json)

        # Populate model response

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Check the agent's response format; see the wrapped parse exception.

When it happens

Trigger: Thrown at litellm/llms/a2a/chat/transformation.py:280 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/e58bb22449d3588e. Report an issue: GitHub.