warpdotdev/warp · error
Authentication failed: {err:#}
Error message
Authentication failed: {err:#} What it means
Raised in the agent-sdk admin device-login flow (app/src/ai/agent_sdk/admin.rs:70) when the AuthManager emits AuthManagerEvent::AuthFailed during authorize_device. The underlying error is embedded with {err:#} (anyhow alternate Debug), and the app is immediately force-terminated (TerminationMode::ForceTerminate) with that error, so the process exits non-zero. It means the authentication backend rejected the flow, not that CLI arguments were wrong.
Source
Thrown at app/src/ai/agent_sdk/admin.rs:70
}
AuthManagerEvent::AuthFailed(_) => {
if !started_device_auth {
// Refresh failed - start a fresh device auth flow.
started_device_auth = true;
AuthManager::handle(ctx).update(ctx, |auth_manager, ctx| {
auth_manager.authorize_device(ctx);
});
} else {
// Device auth failed.
let err_msg = match event {
AuthManagerEvent::AuthFailed(err) => {
format!("Authentication failed: {err:#}")
}
_ => "Authentication failed".to_string(),
};
ctx.terminate_app(
TerminationMode::ForceTerminate,
Some(Err(anyhow::anyhow!(err_msg))),
);
}
}
AuthManagerEvent::ReceivedDeviceAuthorizationCode {
verification_url,
verification_url_complete,
user_code,
} => {
if let Some(url) = verification_url_complete {
println!("To log in, open this URL in your browser:\n{url}");
} else {
println!(
"To log in, visit {verification_url} and enter this code: {user_code}"
);
}
}
_ => {}
},View on GitHub (pinned to e72fd7aacb)
Solutions
- Re-run the command to start a fresh device-authorization flow and complete it in the browser promptly
- Verify network access to the auth and verification endpoints (proxy, VPN, firewall rules)
- Sign out and sign back in to reset stored credentials, then retry
- If it persists, read the embedded {err:#} detail for the backend reason and check auth service status
Defensive patterns
Strategy: retry
Validate before calling
let auth_state = AuthStateProvider::as_ref(ctx).get();
if auth_state.user_id().is_none() {
// complete device auth before running admin commands that call authorize_device
} Try / catch
// Auth failures arrive as events, not Results — decide between re-auth and surfacing:
match event {
AuthManagerEvent::AuthFailed(err) => {
// optionally retry authorize_device(ctx) once before terminating with Err(anyhow!("Authentication failed: {err:#}"))
}
other => { /* forward to remaining handlers */ }
} Prevention
- Complete device-auth flows promptly; device codes expire and reuse triggers AuthFailed
- Reset stored credentials (sign out/in) after account password or device changes
- Treat AuthFailed as retryable once before surfacing it as terminal
When it happens
Trigger: Running an admin/agent-sdk command that triggers authorize_device, and the AuthManager later emits AuthFailed(err): expired or reused device code, revoked credentials, or the auth server returning failure mid device-authorization.
Common situations: Stored credentials revoked after a password change or device deauthorization; auth server unreachable or erroring mid-flow; a stale half-completed device flow being resumed; locked keychain so prior state could not be restored.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- claude -p exited {result.returncode} stderr: {result.stderr}
- Could not determine user ID. Are you logged in?
- User is not on a team
- User should be logged in
- schema_unavailable_or_invalid
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/77696d3e7af63569.
Report an issue: GitHub.