Kuberwastaken/claurst · error · anyhow::Error
Bridge register: auth error
Error message
Bridge register: auth error ({}) What it means
After `exchange_code` succeeds in `run_mcp_auth_session`, the obtained token is persisted via `store_mcp_token`. If the storage write fails, the error is wrapped as "Failed to store MCP token for '<server>': <e>". It means the OAuth exchange worked but the credentials could not be saved locally, so subsequent sessions would have to re-authenticate.
Solutions
- Read the wrapped inner error to see whether it is a file permission, disk-space, or serialization problem.
- Check that the credential/token store location (typically under the user config dir) exists and is writable: `ls -la` and fix ownership/permissions.
- Free disk space or fix the quota if the write failed due to capacity.
- If the store file is corrupted, move it aside (back it up) and re-run `run_mcp_auth_flow` to recreate it.
Defensive patterns
Strategy: try-catch
Try / catch
if let Err(e) = run_mcp_auth_flow(&session).await {
if e.to_string().contains("Failed to store MCP token") {
eprintln!("Token store unwritable: {} — check permissions/disk space", e);
}
return Err(e);
} Prevention
- Ensure the user config/credentials directory exists and is writable before starting auth
- Monitor disk space/quota on machines that run the auth flow
- Back up and restore a clean token store if it becomes corrupted
When it happens
Trigger: `store_mcp_token(&token)` returns Err — the token store file cannot be opened or written (permissions, disk full, corrupted store), or serialization of `McpToken` fails.
Common situations: Read-only or noexec home/credential directory (CI containers); disk quota exceeded; credential-store file owned by another user or corrupted by a partial previous write.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- models endpoint returned
- Invalid JWT: expected at least 2 dot-separated segments
- Invalid : contains unsafe characters
- Bridge register: server returned
- Bridge poll: auth error
AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10).
Data as JSON: /api/errors/59247b047fcda8b5.
Report an issue: GitHub.
Appendix: source
Thrown at src-rust/crates/bridge/src/lib.rs:483
.post(&url)
.bearer_auth(token)
.header("anthropic-version", "2023-06-01")
.header("x-environment-runner-version", &self.config.runner_version)
.json(&body)
.send()
.await
.context("Bridge register: HTTP send failed")?;
let status = resp.status().as_u16();
match status {
200 | 201 => {
self.set_state(BridgeState::Connected);
info!(session_id = %self.session_id, "Bridge session registered");
Ok(())
}
401 | 403 => {
self.set_state(BridgeState::Error(format!("Auth error: {status}")));
anyhow::bail!("Bridge register: auth error ({})", status)
}
_ => {
anyhow::bail!("Bridge register: server returned {}", status)
}
}
}
/// Deregister the session on clean shutdown.
///
/// DELETE `/api/claude_code/sessions/{id}` — best-effort; errors are
/// logged and swallowed so they don't block process exit.
pub async fn deregister(&self) {
let Some(token) = self.config.session_token.as_deref() else {
return;
};
let url = format!(
"{}/api/claude_code/sessions/{}",
View on GitHub (pinned to b0637c97ec)