BerriAI/litellm · error · HTTPException

Discovery failed: {exc}

Error message

Discovery failed: {exc}

What it means

Catch-all in the admin A2A discovery endpoint: fetch_well_known_card raised an unexpected (non-AgentCardDiscoveryError) exception; it is surfaced as HTTP 400 with the exception text so admins can diagnose the target agent.

Source

Thrown at litellm/proxy/a2a/endpoints.py:107

    ```
    """
    if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
        raise HTTPException(
            status_code=403,
            detail=(f"Only proxy admins can discover agent cards. Your role={user_api_key_dict.user_role}"),
        )

    try:
        card: Final = await fetch_well_known_card(
            request.url,
            discovery_mode=request.discovery_mode,
            params=request.params,
        )
    except AgentCardDiscoveryError as exc:
        raise HTTPException(status_code=400, detail=str(exc))
    except Exception as exc:
        verbose_proxy_logger.exception("Unexpected error during A2A discovery: %s", exc)
        raise HTTPException(status_code=500, detail=f"Discovery failed: {exc}")

    return JSONResponse(
        content={"url": request.url, "agent_card": card},
        media_type="application/json",
    )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the underlying exception; check agent URL reachability and config.

Example fix

Check proxy logs for the discovery exception.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/a2a/endpoints.py:107 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/e842875ffe8fe841. Report an issue: GitHub.