tinyhumansai/openhuman · error · anyhow::Error

failed to build HTTP client

Error message

failed to build HTTP client: {e}

What it means

Construction of the shared backend reqwest client failed at the TLS/transport layer (client builder rejected its configuration, e.g. incompatible TLS options or environment); since every backend call needs this client, BackendOAuthClient creation aborts.

Solutions

  1. Inspect the wrapped source error for the rejected builder option
  2. Check proxy/TLS environment variables for malformed values
  3. Fix platform TLS prerequisites and retry client creation
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/api/rest.rs:288 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/b15a412f58b34306. Report an issue: GitHub.

Appendix: source

Thrown at src/api/rest.rs:288

        }
    }
    // Which product this core is embedded in. Set at the transport level rather
    // than only on the SDK because `raw_client()` hands this same client to
    // callers that bypass the SDK entirely (multipart STT upload), and that
    // traffic needs attributing too.
    let (name, value) = crate::api::product::product_identity_header();
    default_headers.insert(name, value);

    // Platform-appropriate TLS backend: Windows → schannel (honors the OS
    // cert store, required for corporate TLS-inspection proxies); macOS /
    // Linux → rustls. See [`crate::openhuman::util::tls::tls_client_builder`].
    crate::openhuman::util::tls::tls_client_builder()
        .default_headers(default_headers)
        .http1_only()
        .timeout(Duration::from_secs(120))
        .connect_timeout(Duration::from_secs(15))
        .build()
        .map_err(|e| anyhow::anyhow!("failed to build HTTP client: {e}"))
}

/// Normalize the backend envelope while preserving OpenHuman's historical
/// response shape. In particular, `/auth/me` returns `{success,user}` rather
/// than `{success,data}`; SDK transport must not expose that envelope detail to
/// existing callers.
fn parse_api_response_value(value: Value) -> Result<Value> {
    let Some(object) = value.as_object() else {
        return Ok(value);
    };
    if let Some(user) = object.get("user").filter(|user| !user.is_null()) {
        return Ok(user.clone());
    }
    let Some(success) = object.get("success").and_then(Value::as_bool) else {
        return Ok(value);
    };
    if !success {
        let message = object

View on GitHub (pinned to 7491200858)