{"record":{"id":"13748f66929c857a","repo":"crewAIInc/crewAI","slug":"could-not-validate-auth-against-agentcard-security","errorCode":null,"errorMessage":"Could not validate auth against AgentCard security requirements","messagePattern":"Could not validate auth against AgentCard security requirements","errorType":"exception","errorClass":"A2AClientHTTPError","httpStatus":401,"severity":"error","filePath":"lib/crewai/src/crewai/a2a/auth/utils.py","lineNumber":191,"sourceCode":"        if not security_scheme_wrapper:\n            continue\n\n        scheme = security_scheme_wrapper.root\n\n        if allowed_classes := _SCHEME_AUTH_MAPPING.get(type(scheme)):\n            if not isinstance(auth, allowed_classes):\n                _raise_auth_mismatch(allowed_classes, auth)\n            return\n\n        if isinstance(scheme, HTTPAuthSecurityScheme):\n            scheme_key = cast(_HTTPSchemeType, scheme.scheme.lower())\n            if required_class := _HTTP_SCHEME_MAPPING.get(scheme_key):\n                if not isinstance(auth, required_class):\n                    _raise_auth_mismatch(required_class, auth)\n            return\n\n    msg = \"Could not validate auth against AgentCard security requirements\"\n    raise A2AClientHTTPError(401, msg)\n\n\nasync def retry_on_401(\n    request_func: Callable[[], Awaitable[Response]],\n    auth_scheme: ClientAuthScheme | None,\n    client: AsyncClient,\n    headers: MutableMapping[str, str],\n    max_retries: int = 3,\n) -> Response:\n    \"\"\"Retry a request on 401 authentication error.\n\n    Handles 401 errors by:\n    1. Parsing WWW-Authenticate header\n    2. Re-acquiring credentials\n    3. Retrying the request\n\n    Args:\n        request_func: Async function that makes the HTTP request.","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai/src/crewai/a2a/auth/utils.py#L173-L209","documentation":"Error \"Could not validate auth against AgentCard security requirements\" thrown in crewAIInc/crewAI.","triggerScenarios":"Thrown at lib/crewai/src/crewai/a2a/auth/utils.py:191 when the library encounters an invalid state.","commonSituations":"Occurs when the provided credentials cannot satisfy any of the AgentCard's security requirements. Check that the credentials match one of the declared security schemes.","solutions":["Ensure the provided credentials satisfy one of the AgentCard's security requirement alternatives.","Check that the auth scheme name matches a scheme declared in the AgentCard."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}