Kuberwastaken/claurst · error · anyhow::Error

start_bridge: bridge is not active

Error message

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

What it means

`refresh_mcp_token` POSTs the refresh grant (`grant_type=refresh_token`) to the token endpoint. If the reqwest request fails at the transport level (DNS, connect, TLS, timeout), the error is wrapped as "refresh: request failed: {}". This is a network failure, distinct from the provider rejecting the refresh token with a non-2xx status.

Solutions

  1. Check connectivity to the token endpoint host (curl -v the URL).
  2. Configure proxy env vars if a corporate proxy is required.
  3. Verify the token_endpoint passed to `refresh_mcp_token` is still the provider's current endpoint (metadata may have changed).
  4. Retry once connectivity is restored — refresh is idempotent until the token is actually rotated.
Defensive patterns

Strategy: retry

Try / catch

match refresh_mcp_token(server, endpoint).await {
    Ok(t) => t,
    Err(e) if e.to_string().contains("refresh: request failed") => {
        tokio::time::sleep(Duration::from_secs(5)).await;
        refresh_mcp_token(server, endpoint).await
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: `client.post(token_endpoint).form(&params).send().await` returns Err while refreshing — unreachable network, DNS failure, TLS error, connection refused, or timeout.

Common situations: Machine went offline between getting and refreshing the token; proxy misconfiguration; token endpoint down or hostname wrong in the stored metadata; firewall blocking outbound HTTPS.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

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

        .timeout(std::time::Duration::from_secs(30))
        .user_agent(format!("claude-code-rust/{}", env!("CARGO_PKG_VERSION")))
        .build()
        .context("start_bridge: failed to build HTTP client")?;

    start_bridge_with_client(config, http, cancel).await
}

async fn start_bridge_with_client(
    config: BridgeConfig,
    _http: reqwest::Client,
    cancel: CancellationToken,
) -> anyhow::Result<(
    mpsc::Receiver<BridgeMessage>,
    mpsc::Sender<BridgeEvent>,
    String,
)> {
    if !config.is_active() {
        anyhow::bail!("start_bridge: bridge is not active (enabled={}, token={})",
            config.enabled,
            config.session_token.is_some()
        );
    }

    let mut session = BridgeSession::new(config);
    session
        .register()
        .await
        .context("start_bridge: session registration failed")?;

    let session_id = session.session_id().to_string();

    // Bounded channels — back-pressure prevents unbounded memory growth on a
    // slow consumer.
    let (msg_tx, msg_rx) = mpsc::channel::<BridgeMessage>(64);
    let (event_tx, event_rx) = mpsc::channel::<BridgeEvent>(256);

View on GitHub (pinned to b0637c97ec)