Kuberwastaken/claurst · error · anyhow::Error

poll_bridge_messages: server returned HTTP

Error message

poll_bridge_messages: server returned HTTP {}

What it means

Catch-all failure for the bridge message poll: the GET returned a status outside the handled set (200/204/429/auth errors) — typically a 5xx or unexpected 3xx from the bridge server. The formatted status identifies which unclassified response ended the poll iteration.

Solutions

  1. Retry the poll after a short delay; transient server errors often clear
  2. Capture the status code and response body to classify the failure if it persists
  3. Verify the bridge endpoint URL matches the current deployment
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src-rust/crates/bridge/src/lib.rs:1108 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/2b6be110b96bad8a. Report an issue: GitHub.

Appendix: source

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

                    serde_json::from_str(&text).context("poll_bridge_messages: JSON parse")?;
                return Ok(msgs);
            }
            204 => return Ok(vec![]),
            429 => {
                attempt += 1;
                if attempt > max_retries {
                    anyhow::bail!("poll_bridge_messages: rate-limited (HTTP 429) after {} retries", max_retries);
                }
                let backoff = std::time::Duration::from_millis(1_000 * 2u64.pow(attempt - 1));
                warn!(attempt, "Bridge poll rate-limited; backing off {:?}", backoff);
                tokio::time::sleep(backoff).await;
                continue;
            }
            401 | 403 => {
                anyhow::bail!("poll_bridge_messages: auth error (HTTP {})", status);
            }
            _ => {
                anyhow::bail!("poll_bridge_messages: server returned HTTP {}", status);
            }
        }
    }
}

/// Post a response to a specific incoming message on an active bridge session.
///
/// PUTs `/api/bridge/sessions/<session_id>/messages/<msg_id>/response` with
/// a JSON body `{"content": "<response>", "done": true}`.
pub async fn post_bridge_response(
    info: &BridgeSessionInfo,
    msg_id: &str,
    content: &str,
    done: bool,
) -> anyhow::Result<()> {
    let server_url = std::env::var("CLAURST_BRIDGE_URL")
        .or_else(|_| std::env::var("CLAUDE_BRIDGE_BASE_URL"))
        .unwrap_or_else(|_| "https://claude.ai".to_string());

View on GitHub (pinned to b0637c97ec)