Kuberwastaken/claurst · critical
Failed to build reqwest client
Error message
Failed to build reqwest client
What it means
This panic comes from an `.expect()` on `reqwest::Client::builder().build()` when constructing the bridge's HTTP client (30s timeout, claude-code-rust user agent). The builder only fails on process-wide initialization problems, essentially always TLS backend setup, so the code treats it as unrecoverable during `Bridge::new`.
Solutions
- Verify TLS linkage: run `ldd` on the binary and install the missing `libssl`/crypto library, or build with reqwest's `rustls-tls` feature instead of native-tls.
- Install CA certificates in the deployment image (`ca-certificates` package).
- Check for conflicting `CryptoProvider` initializers if using rustls 0.23+ (only one process-wide provider may be installed).
- Make `Bridge::new` return `Result` and propagate the `reqwest::Error` with context rather than panicking.
Example fix
// before
.build()
.expect("Failed to build reqwest client");
// after
.build()
.map_err(|e| BridgeError::Init(format!("Failed to build reqwest client: {e}")))?; Defensive patterns
Strategy: fallback
Validate before calling
// Startup probe before creating the Bridge:
fn http_stack_ok() -> bool {
reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(1))
.build()
.is_ok()
} Try / catch
// Panic, not Result — isolate construction:
let bridge = std::panic::catch_unwind(|| Bridge::new(config, session_id))
.map_err(|_| anyhow::anyhow!("bridge init failed: cannot build HTTP client (TLS backend?)"))?; Prevention
- Prefer rustls over native-tls in Cargo features for portable binaries
- Verify CA certificates and libssl exist in the target container
- Check for conflicting rustls CryptoProvider installs when linking other crates
- Probe HTTP client construction once during startup and fail fast with a clear message
When it happens
Trigger: Calling `Bridge::new(config, session_id)` in a process where reqwest cannot initialize its TLS backend — e.g. missing native TLS library or rustls crypto provider conflict.
Common situations: Minimal Linux containers without libssl or CA certs; statically-linked musl builds missing TLS pieces; environments where another component already installed a different ring/aws-lc crypto provider for rustls.
Related errors
- failed to build reqwest client
- failed to build reqwest client
- failed to build reqwest client
- failed to build reqwest client
- failed to build reqwest client
AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10).
Data as JSON: /api/errors/d684886b96c81751.
Report an issue: GitHub.
Appendix: source
Thrown at src-rust/crates/bridge/src/lib.rs:411
state: Arc<RwLock<BridgeState>>,
http: reqwest::Client,
reconnect_count: u32,
#[allow(dead_code)]
last_ping: Option<std::time::Instant>,
}
impl BridgeSession {
/// Create a new bridge session; generates a fresh UUID for `session_id`.
pub fn new(config: BridgeConfig) -> Self {
let session_id = uuid::Uuid::new_v4().to_string();
let http = reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(30))
.user_agent(format!(
"claude-code-rust/{}",
env!("CARGO_PKG_VERSION")
))
.build()
.expect("Failed to build reqwest client");
Self {
config,
session_id,
state: Arc::new(RwLock::new(BridgeState::Connecting)),
http,
reconnect_count: 0,
last_ping: None,
}
}
pub fn session_id(&self) -> &str {
&self.session_id
}
pub fn current_state(&self) -> BridgeState {
self.state.read().clone()
}
View on GitHub (pinned to b0637c97ec)