{"record":{"id":"fad6aa11ba39375c","repo":"BerriAI/litellm","slug":"a2a-sdk-is-required-for-localhost-retry-handling","errorCode":null,"errorMessage":"A2A SDK is required for localhost retry handling. Install it with: pip install a2a-sdk","messagePattern":"A2A SDK is required for localhost retry handling\\. Install it with: pip install a2a-sdk","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/exception_mapping_utils.py","lineNumber":185,"sourceCode":"    Handle A2ALocalhostURLError by fixing the URL and creating a new client.\n\n    This is called when we catch an A2ALocalhostURLError and want to retry\n    with the corrected URL.\n\n    Args:\n        error: The localhost URL error\n        agent_card: The agent card object to fix\n        a2a_client: The current A2A client\n        is_streaming: Whether this is a streaming request (for logging)\n\n    Returns:\n        A new A2A client with the fixed URL\n\n    Raises:\n        ImportError: If the A2A SDK is not installed\n    \"\"\"\n    if not A2A_SDK_AVAILABLE:\n        raise ImportError(\"A2A SDK is required for localhost retry handling. Install it with: pip install a2a-sdk\")\n\n    if agent_card is None:\n        raise RuntimeError(\n            \"Cannot retry A2A localhost URL fix: no agent card is available to \"\n            \"rewrite, so the upstream URL cannot be corrected.\"\n        )\n\n    request_type: Final = \"streaming \" if is_streaming else \"\"\n    verbose_logger.warning(\n        \"A2A %srequest to '%s' failed: %s. Agent card contains localhost/internal URL. Retrying with base_url '%s'.\",\n        request_type,\n        error.localhost_url,\n        error.original_error,\n        error.base_url,\n    )\n\n    # Fix the agent card URL\n    set_agent_card_url(agent_card, error.base_url)","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/a2a_protocol/exception_mapping_utils.py#L167-L203","documentation":"Error \"A2A SDK is required for localhost retry handling. Install it with: pip install a2a-sdk\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/a2a_protocol/exception_mapping_utils.py:185 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the A2A SDK: pip install a2a-sdk."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}