tinyhumansai/openhuman · error

failed to build shared SearXNG HTTP client

Error message

failed to build shared SearXNG HTTP client

What it means

Panic payload inside shared_http_client(): the SearXNG tool lazily builds one process-wide reqwest client in a OnceLock (platform TLS backend + timeouts). A build failure here is environment-level (TLS/proxy) and, because it happens inside get_or_init on first use (from new()), it poisons the OnceLock and permanently disables SearXNG search for the process.

Source

Thrown at src/openhuman/search/tools/searxng.rs:29

use serde::{Deserialize, Serialize};
use serde_json::json;
use std::sync::OnceLock;
use std::time::Duration;

const DEFAULT_SOURCE: &str = "searxng";
/// Maximum number of SearXNG results accepted by the public tool surface.
pub const MAX_RESULTS: usize = 50;

static SHARED_HTTP_CLIENT: OnceLock<reqwest::Client> = OnceLock::new();

fn shared_http_client() -> reqwest::Client {
    SHARED_HTTP_CLIENT
        .get_or_init(|| {
            tracing::debug!("[searxng] initializing shared HTTP client");
            // Platform-appropriate TLS backend — see [`crate::openhuman::util::tls`].
            crate::openhuman::util::tls::tls_client_builder()
                .build()
                .expect("failed to build shared SearXNG HTTP client")
        })
        .clone()
}

#[derive(Debug, Clone, PartialEq, Eq)]
/// Search arguments accepted by the SearXNG tool.
pub struct SearxngSearchArgs {
    /// Search query sent as SearXNG's `q` parameter.
    pub query: String,
    /// Optional SearXNG categories. `web` is normalized to `general`.
    pub categories: Vec<String>,
    /// Optional language code. Falls back to the configured default when absent.
    pub language: Option<String>,
    /// Optional per-call result limit, clamped to the supported maximum.
    pub max_results: Option<usize>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]

View on GitHub (pinned to 7491200858)

Solutions

  1. Check TLS backend availability and proxy configuration on the host
  2. Restart the process after fixing the environment — the OnceLock stays poisoned for the process lifetime
  3. Avoid .expect inside get_or_init; store a Result so later callers can retry or degrade
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/search/tools/searxng.rs:29 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/3566cb61ee3f3e25. Report an issue: GitHub.