{"record":{"id":"a8c63f4b6a4ef17f","repo":"Kuberwastaken/claurst","slug":"bridge-session-registration-failed-authentication","errorCode":null,"errorMessage":"Bridge session registration failed: authentication error (HTTP {}).\\nYour token may be invalid or expired.\\nGet a new token from https://claude.ai (Settings → Remote Control).","messagePattern":"Bridge session registration failed: authentication error \\(HTTP (.+?)\\)\\.\\\\nYour token may be invalid or expired\\.\\\\nGet a new token from https://claude\\.ai \\(Settings → Remote Control\\)\\.","errorType":"http","errorClass":"anyhow::Error","httpStatus":401,"severity":"error","filePath":"src-rust/crates/bridge/src/lib.rs","lineNumber":997,"sourceCode":"\r\n    let resp = http\r\n        .post(&register_url)\r\n        .bearer_auth(&token)\r\n        .header(\"anthropic-version\", \"2023-06-01\")\r\n        .header(\"anthropic-beta\", \"environments-2025-11-01\")\r\n        .json(&body)\r\n        .send()\r\n        .await\r\n        .context(\"start_bridge_session: HTTP POST failed\")?;\r\n\r\n    let status = resp.status().as_u16();\r\n\r\n    match status {\r\n        200 | 201 => {\r\n            info!(session_id = %session_id, \"Bridge session registered successfully\");\r\n        }\r\n        401 | 403 => {\r\n            anyhow::bail!(\r\n                \"Bridge session registration failed: authentication error (HTTP {}).\\n\\\r\n                 Your token may be invalid or expired.\\n\\\r\n                 Get a new token from https://claude.ai (Settings → Remote Control).\",\r\n                status\r\n            );\r\n        }\r\n        404 => {\r\n            // The /api/bridge/sessions endpoint may not exist in all deployments.\r\n            // Fall through to synthetic session URL (best-effort mode).\r\n            warn!(\r\n                session_id = %session_id,\r\n                \"Bridge registration endpoint not found (HTTP 404) — \\\r\n                 using local session ID without server validation\"\r\n            );\r\n        }\r\n        _ => {\r\n            let body_text = resp.text().await.unwrap_or_default();\r\n            anyhow::bail!(\r","sourceCodeStart":979,"sourceCodeEnd":1015,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/bridge/src/lib.rs#L979-L1015","documentation":"`RmcpBackend::connect_stdio` (src-rust/crates/mcp/src/rmcp_backend.rs:120) spawns the MCP server as a child process over stdio using `McpServerConfig`. If the config has no `command` field, the `ok_or_else` on the clone produces \"MCP server '<name>' has no command configured\". The library cannot launch a stdio MCP server without a command to execute.","triggerScenarios":"`config.command` is None when calling `connect_stdio` — an MCP server entry in settings/config specifies a name (and maybe args/env) but omits the executable command, typically for a server intended to be reached via HTTP/SSE instead of stdio.","commonSituations":"Config file entry like `{\"name\": \"my-server\", \"args\": [\"-y\", \"pkg\"]}` missing the `command` key; user added a remote MCP server but the code path chose stdio transport; a typo'd key (`cmd` instead of `command`) so it deserialized as None.","solutions":["Add the `command` field to the MCP server config entry, e.g. `\"command\": \"npx\"`.","Check the key spelling in the config file — it must be `command`, not `cmd` or `executable`.","If the server is remote (HTTP/SSE), use the transport/config path intended for remote servers instead of `connect_stdio`.","Validate the config against `McpServerConfig` (serde) before connecting to catch missing fields early."],"exampleFix":"// before (mcp servers config)\n{ \"name\": \"my-server\", \"args\": [\"-y\", \"@some/mcp-server\"] }\n// after\n{ \"name\": \"my-server\", \"command\": \"npx\", \"args\": [\"-y\", \"@some/mcp-server\"] }","handlingStrategy":"validation","validationCode":"// validate server configs before connecting\nfor cfg in &settings.mcp_servers {\n    if cfg.command.is_none() {\n        bail!(\"MCP server '{}' is missing the 'command' field\", cfg.name);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate MCP server config entries (command present) at startup, before any connect attempt","Spell the key exactly as `command` in settings files","Use the remote-server (HTTP/SSE) config path for network MCP servers, not stdio"],"tags":["mcp","config","stdio","missing-field"],"backgroundTag":"missing-required-config-field","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}