tinyhumansai/openhuman · error

Brave Search unavailable: no API key configured. Set OPENHUM

Error message

Brave Search unavailable: no API key configured. Set OPENHUMAN_BRAVE_API_KEY or `search.brave.api_key` in config.toml and select `search.engine = "brave"`.

What it means

A configuration sentinel from `BraveConfig::require_key`: the Brave Search tools short-circuit because no usable API key is wired up. The key is read from `OPENHUMAN_BRAVE_API_KEY` or `search.brave.api_key` in config.toml; entries that are empty or whitespace-only are treated as absent by design. The tool deliberately fails loudly so the agent surfaces the misconfiguration instead of silently routing to another engine.

Source

Thrown at src/openhuman/search/tools/brave.rs:49

        .build()
        .map_err(|e| anyhow::anyhow!("failed to build Brave HTTP client: {e}"))
}

#[derive(Debug, Clone)]
struct BraveConfig {
    api_key: Option<String>,
    max_results: usize,
    timeout_secs: u64,
}

impl BraveConfig {
    fn require_key(&self) -> anyhow::Result<&str> {
        self.api_key
            .as_deref()
            .map(str::trim)
            .filter(|s| !s.is_empty())
            .ok_or_else(|| {
                anyhow::anyhow!(
                    "Brave Search unavailable: no API key configured. \
                     Set OPENHUMAN_BRAVE_API_KEY or `search.brave.api_key` \
                     in config.toml and select `search.engine = \"brave\"`."
                )
            })
    }
}

async fn brave_get(
    cfg: &BraveConfig,
    path: &str,
    query: &[(&str, String)],
) -> anyhow::Result<Value> {
    let key = cfg.require_key()?;
    let url = format!("{DEFAULT_API_BASE}{path}");
    tracing::debug!(
        path = %path,
        timeout_secs = cfg.timeout_secs,

View on GitHub (pinned to 7491200858)

Solutions

  1. Export `OPENHUMAN_BRAVE_API_KEY=<key>` in the environment
  2. Or set `search.brave.api_key` in config.toml and select `search.engine = "brave"`
  3. Verify the key is non-empty after trimming — a blank value still triggers this error
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/search/tools/brave.rs:49 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/89f1a59763b07089. Report an issue: GitHub.