{"record":{"id":"bee58d5794604799","repo":"Kuberwastaken/claurst","slug":"run-bridge-loop-bridge-is-not-active-enabled","errorCode":null,"errorMessage":"run_bridge_loop: bridge is not active (enabled={}, token={})","messagePattern":"run_bridge_loop: bridge is not active \\(enabled=(.+?), token=(.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/bridge/src/lib.rs","lineNumber":1346,"sourceCode":"/// [`BridgeMessage`] poll results into [`TuiBridgeEvent`] values and\r\n/// forwarding [`BridgeOutbound`] events to the server.\r\n///\r\n/// # Parameters\r\n/// - `config` — bridge configuration (must be active: `enabled == true` and\r\n///   `session_token` is `Some`).\r\n/// - `tui_tx` — channel used to send state-change events to the TUI / main\r\n///   loop.\r\n/// - `outbound_rx` — channel for receiving outbound events from the query\r\n///   loop to upload to the bridge server.\r\n/// - `cancel` — token that triggers a clean shutdown of the loop.\r\npub async fn run_bridge_loop(\r\n    config: BridgeConfig,\r\n    tui_tx: mpsc::Sender<TuiBridgeEvent>,\r\n    mut outbound_rx: mpsc::Receiver<BridgeOutbound>,\r\n    cancel: tokio_util::sync::CancellationToken,\r\n) -> anyhow::Result<()> {\r\n    if !config.is_active() {\r\n        anyhow::bail!(\r\n            \"run_bridge_loop: bridge is not active (enabled={}, token={})\",\r\n            config.enabled,\r\n            config.session_token.is_some()\r\n        );\r\n    }\r\n\r\n    // Build a BridgeSession and register with the server.\r\n    let mut session = BridgeSession::new(config.clone());\r\n\r\n    // Attempt initial registration; retry with back-off on transient errors.\r\n    let base_backoff = std::time::Duration::from_millis(1_000);\r\n    let max_backoff = std::time::Duration::from_secs(30);\r\n    let mut reg_attempts = 0u32;\r\n\r\n    loop {\r\n        match session.register().await {\r\n            Ok(()) => break,\r\n            Err(e) => {\r","sourceCodeStart":1328,"sourceCodeEnd":1364,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/bridge/src/lib.rs#L1328-L1364","documentation":"Sentinel guard at the top of run_bridge_loop: the loop refuses to start because the supplied BridgeConfig is not active — either enabled is false or session_token is None (the message shows both). This is a precondition check, not a runtime failure; the caller asked to run the bridge without a usable configuration.","triggerScenarios":"Thrown at src-rust/crates/bridge/src/lib.rs:1346 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable the bridge in settings and provide a session_token before starting the loop","Skip calling run_bridge_loop when the config is inactive; treat Ok/no-op as correct behavior for a disabled bridge","Verify config loading did not silently drop the token (e.g. malformed settings file)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}