{"record":{"id":"1907ddd174047002","repo":"xai-org/grok-build","slug":"no-auth-methods-available","errorCode":null,"errorMessage":"No auth methods available","messagePattern":"No auth methods available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/acp/mod.rs","lineNumber":798,"sourceCode":"            None,\n        ),\n    }\n}\n\n/// Authenticate with the agent using the agent's chosen default method.\n///\n/// Prefer `defaultAuthMethodId` from initialize meta when present and listed.\n/// Do not re-derive api_key vs session ordering client-side (that has regressed OIDC refresh before).\n/// Legacy fallback: `cached_token` then first method.\n///\n/// Returns the response `meta` (contains `team_name`, etc.) so callers can propagate it to the UI.\nasync fn authenticate(\n    tx: &AcpAgentTx,\n    auth_methods: &[acp::AuthMethod],\n    default_auth_method_id: Option<&acp::AuthMethodId>,\n) -> Result<Option<serde_json::Value>> {\n    let method_id = select_eager_auth_method(auth_methods, default_auth_method_id)\n        .ok_or_else(|| anyhow::anyhow!(\"No auth methods available\"))?;\n    crate::unified_log::info(\n        \"pager eager auth method selected\",\n        None,\n        Some(serde_json::json!({\n            \"method_id\": method_id.0.as_ref(),\n            \"from_default_auth_method_id\": default_auth_method_id\n                .is_some_and(|d| d.0.as_ref() == method_id.0.as_ref()),\n            \"methods_count\": auth_methods.len(),\n            \"first_method\": auth_methods.first().map(|m| m.id().0.as_ref()),\n        })),\n    );\n\n    let resp: acp::AuthenticateResponse =\n        acp_send(acp::AuthenticateRequest::new(method_id), tx).await?;\n    Ok(resp.meta.map(serde_json::Value::Object))\n}\n\n/// Pick the method id for eager authenticate.","sourceCodeStart":780,"sourceCodeEnd":816,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/acp/mod.rs#L780-L816","documentation":"authenticate could not find any usable auth method: select_eager_auth_method returned None because the ACP agent advertised no auth methods and no default_auth_method_id fallback was available. The library throws this to abort eager authentication before calling the agent's authenticate RPC.","triggerScenarios":"Calling authenticate (via eager_auth_or_login_fallback) when the agent's newSession/authenticate response contains an empty authMethods list and default_auth_method_id is None.","commonSituations":"Agent not logged in and exposing no auth methods, misconfigured agent backend, API version mismatch where auth method advertisement changed, expired credentials causing the agent to drop its method list.","solutions":["Check why the agent advertised zero auth methods (agent logs, backend auth status)","Provide a default_auth_method_id so select_eager_auth_method has a fallback","Run the interactive login flow (login fallback) instead of eager auth","Verify agent/client ACP protocol versions agree on auth method advertisement"],"exampleFix":"// before\nlet value = authenticate(&tx, &auth_methods, None).await?;\n// after\nmatch authenticate(&tx, &auth_methods, default_auth_method_id.as_ref()).await {\n    Ok(value) => value,\n    Err(e) if e.to_string().contains(\"No auth methods\") => login_fallback(&tx).await?,\n    Err(e) => return Err(e),\n}","handlingStrategy":"fallback","validationCode":"fn can_eager_auth(methods: &[acp::AuthMethod], default_id: Option<&acp::AuthMethodId>) -> bool {\n    !methods.is_empty() || default_id.is_some()\n}\n// if false, go straight to interactive login","typeGuard":null,"tryCatchPattern":"match authenticate(&tx, &methods, default.as_ref()).await {\n    Ok(v) => Ok(Some(v)),\n    Err(e) if e.to_string().contains(\"No auth methods available\") => login_fallback(&tx).await,\n    Err(e) => Err(e),\n}","preventionTips":["Always pass default_auth_method_id when the user has prior credentials","Check advertised authMethods from the agent before attempting eager auth","Keep client/agent ACP versions compatible so auth methods are advertised","Ensure the agent backend is authenticated/configured before spawning sessions"],"tags":["auth","acp","login"],"backgroundTag":"no-auth-methods","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}