crewAIInc/crewAI · error · A2AClientHTTPError

AgentCard requires authentication but no auth scheme provide

Error message

AgentCard requires authentication but no auth scheme provided

What it means

Error "AgentCard requires authentication but no auth scheme provided" thrown in crewAIInc/crewAI.

Source

Thrown at lib/crewai/src/crewai/a2a/auth/utils.py:167

def validate_auth_against_agent_card(
    agent_card: AgentCard, auth: ClientAuthScheme | None
) -> None:
    """Validate that provided auth matches AgentCard security requirements.

    Args:
        agent_card: The A2A AgentCard containing security requirements.
        auth: User-provided authentication scheme (or None).

    Raises:
        A2AClientHTTPError: If auth doesn't match AgentCard requirements (status_code=401).
    """

    if not agent_card.security or not agent_card.security_schemes:
        return

    if not auth:
        msg = "AgentCard requires authentication but no auth scheme provided"
        raise A2AClientHTTPError(401, msg)

    first_security_req = agent_card.security[0] if agent_card.security else {}

    for scheme_name in first_security_req:
        security_scheme_wrapper = agent_card.security_schemes.get(scheme_name)
        if not security_scheme_wrapper:
            continue

        scheme = security_scheme_wrapper.root

        if allowed_classes := _SCHEME_AUTH_MAPPING.get(type(scheme)):
            if not isinstance(auth, allowed_classes):
                _raise_auth_mismatch(allowed_classes, auth)
            return

        if isinstance(scheme, HTTPAuthSecurityScheme):
            scheme_key = cast(_HTTPSchemeType, scheme.scheme.lower())
            if required_class := _HTTP_SCHEME_MAPPING.get(scheme_key):

View on GitHub (pinned to 754d7323be)

Solutions

  1. Provide an auth scheme matching the AgentCard's security requirements.
  2. Configure credentials for the remote agent before connecting.

When it happens

Trigger: Thrown at lib/crewai/src/crewai/a2a/auth/utils.py:167 when the library encounters an invalid state.

Common situations: Occurs when the target AgentCard requires authentication but the request carries no auth scheme. Provide an authentication scheme matching the AgentCard security requirements.

Understand the failure class


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/82e5f7fc6288cde0. Report an issue: GitHub.