{"record":{"id":"58fa74f1d90f12b8","repo":"BerriAI/litellm","slug":"could-not-fetch-agent-card-from-base-url-mode","errorCode":null,"errorMessage":"Could not fetch agent card from {base_url} (mode={discovery_mode.value}). Last error: {last_error}","messagePattern":"Could not fetch agent card from (.+?) \\(mode=(.+?)\\)\\. Last error: (.+?)","errorType":"exception","errorClass":"AgentCardDiscoveryError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/a2a/discovery.py","lineNumber":151,"sourceCode":"        if response.status_code >= 400:\n            last_error = f\"{url}: HTTP {response.status_code}\"\n            verbose_proxy_logger.debug(\"A2A discovery HTTP %s for %s\", response.status_code, url)\n            continue\n\n        try:\n            card = response.json()\n        except Exception as exc:\n            last_error = f\"{url}: invalid JSON ({exc})\"\n            continue\n\n        if not isinstance(card, dict):\n            last_error = f\"{url}: expected JSON object, got {type(card).__name__}\"\n            continue\n\n        verbose_proxy_logger.debug(\"A2A discovery succeeded at %s\", url)\n        return card\n\n    raise AgentCardDiscoveryError(\n        f\"Could not fetch agent card from {base_url} (mode={discovery_mode.value}). Last error: {last_error}\"\n    )\n","sourceCodeStart":133,"sourceCodeEnd":154,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/a2a/discovery.py#L133-L154","documentation":"Raised when every candidate agent-card path failed (network error, HTTP >=400, or non-JSON body) in the chosen discovery mode; the last error is embedded. The base_url, mode, and final failure identify the unreachable/misbehaving agent endpoint.","triggerScenarios":"Thrown at litellm/proxy/a2a/discovery.py:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the base_url serves an agent card and is reachable; see last_error detail."],"exampleFix":"curl <base_url>/.well-known/agent.json","handlingStrategy":"try-catch","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-14T05:17:10.506Z"}