Kuberwastaken/claurst · error · anyhow::Error

run_bridge_loop: bridge is not active

Error message

run_bridge_loop: bridge is not active (enabled={}, token={})

What it means

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.

Solutions

  1. Enable the bridge in settings and provide a session_token before starting the loop
  2. Skip calling run_bridge_loop when the config is inactive; treat Ok/no-op as correct behavior for a disabled bridge
  3. Verify config loading did not silently drop the token (e.g. malformed settings file)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-rust/crates/bridge/src/lib.rs:1346 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/bee58d5794604799. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/bridge/src/lib.rs:1346

/// [`BridgeMessage`] poll results into [`TuiBridgeEvent`] values and
/// forwarding [`BridgeOutbound`] events to the server.
///
/// # Parameters
/// - `config` — bridge configuration (must be active: `enabled == true` and
///   `session_token` is `Some`).
/// - `tui_tx` — channel used to send state-change events to the TUI / main
///   loop.
/// - `outbound_rx` — channel for receiving outbound events from the query
///   loop to upload to the bridge server.
/// - `cancel` — token that triggers a clean shutdown of the loop.
pub async fn run_bridge_loop(
    config: BridgeConfig,
    tui_tx: mpsc::Sender<TuiBridgeEvent>,
    mut outbound_rx: mpsc::Receiver<BridgeOutbound>,
    cancel: tokio_util::sync::CancellationToken,
) -> anyhow::Result<()> {
    if !config.is_active() {
        anyhow::bail!(
            "run_bridge_loop: bridge is not active (enabled={}, token={})",
            config.enabled,
            config.session_token.is_some()
        );
    }

    // Build a BridgeSession and register with the server.
    let mut session = BridgeSession::new(config.clone());

    // Attempt initial registration; retry with back-off on transient errors.
    let base_backoff = std::time::Duration::from_millis(1_000);
    let max_backoff = std::time::Duration::from_secs(30);
    let mut reg_attempts = 0u32;

    loop {
        match session.register().await {
            Ok(()) => break,
            Err(e) => {

View on GitHub (pinned to b0637c97ec)