{"record":{"id":"a2e4e9972a9cfd85","repo":"Kuberwastaken/claurst","slug":"bridge-register-no-session-token","errorCode":null,"errorMessage":"Bridge register: no session token","messagePattern":"Bridge register: no session token","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/bridge/src/lib.rs","lineNumber":448,"sourceCode":"\r\n    fn set_state(&self, s: BridgeState) {\r\n        *self.state.write() = s;\r\n    }\r\n\r\n    // -----------------------------------------------------------------------\r\n    // Session registration / deregistration\r\n    // -----------------------------------------------------------------------\r\n\r\n    /// Register this bridge session with the CCR server.\r\n    ///\r\n    /// POST `/api/claude_code/sessions` — mirrors the TypeScript\r\n    /// `registerBridgeEnvironment` call in `bridgeApi.ts`.\r\n    pub async fn register(&mut self) -> anyhow::Result<()> {\r\n        let token = self\r\n            .config\r\n            .session_token\r\n            .as_deref()\r\n            .ok_or_else(|| anyhow::anyhow!(\"Bridge register: no session token\"))?;\r\n\r\n        let url = format!(\r\n            \"{}/api/claude_code/sessions\",\r\n            self.config.server_url\r\n        );\r\n\r\n        let body = serde_json::json!({\r\n            \"session_id\": self.session_id,\r\n            \"device_id\": self.config.device_id,\r\n            \"client_version\": self.config.runner_version,\r\n        });\r\n\r\n        debug!(session_id = %self.session_id, url = %url, \"Registering bridge session\");\r\n\r\n        let resp = self\r\n            .http\r\n            .post(&url)\r\n            .bearer_auth(token)\r","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/bridge/src/lib.rs#L430-L466","documentation":"The bridge's `register` method creates a Remote Control session on the claude.ai server, which requires a session token for authentication. If `config.session_token` is `None`, registration cannot proceed and this error is returned. It indicates the bridge was started without complete credentials.","triggerScenarios":"Calling `bridge.register()` (directly or via `start_bridge_with_client` / `run_bridge_loop`) when the `BridgeConfig` was constructed with `session_token: None`.","commonSituations":"Starting Remote Control without setting CLAURST_BRIDGE_TOKEN; a config builder that skips the token field; token was cleared after logout; wiring the wrong config struct (e.g. main app config instead of bridge config).","solutions":["Set `session_token` on the `BridgeConfig` before starting the bridge, e.g. from the env var CLAURST_BRIDGE_TOKEN.","Use the higher-level start function that resolves the token from overrides/env (the path at lib.rs:938) instead of constructing `BridgeConfig` by hand.","Re-authenticate to obtain a fresh token from claude.ai (Settings → Remote Control) if the old one was cleared."],"exampleFix":"// before\nlet config = BridgeConfig { server_url, session_token: None, .. };\n// after\nlet config = BridgeConfig {\n    server_url,\n    session_token: std::env::var(\"CLAURST_BRIDGE_TOKEN\").ok(),\n    ..Default::default()\n};","handlingStrategy":"validation","validationCode":"// Validate before calling register\nif bridge.config.session_token.as_deref().unwrap_or(\"\").is_empty() {\n    anyhow::bail!(\"Set CLAURST_BRIDGE_TOKEN before starting Remote Control\");\n}","typeGuard":null,"tryCatchPattern":"bridge.register().await.inspect_err(|e| {\n    if e.to_string().contains(\"no session token\") {\n        eprintln!(\"Enable Remote Control by setting CLAURST_BRIDGE_TOKEN\");\n    }\n})?;","preventionTips":["Always construct BridgeConfig through a builder/start path that resolves the token from env.","Check for the token at app startup when the Remote Control feature is enabled.","Never build BridgeConfig with session_token: None in production code paths."],"tags":["bridge","authentication","remote-control","missing-token"],"backgroundTag":"missing-credentials","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"}