tinyhumansai/openhuman · error

language must be a non-empty string

Error message

language must be a non-empty string

What it means

Optional-field type guard in parse_search_args: "language" was provided but is not a string, or is empty/whitespace after trimming. The parser expects a language code such as "en" or "en-US"; any other shape fails here. The faulting input is a non-string or empty language value.

Source

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

        Some(value) => value
            .as_array()
            .ok_or_else(|| anyhow::anyhow!("categories must be an array of strings"))?
            .iter()
            .map(|item| {
                item.as_str()
                    .map(str::to_string)
                    .ok_or_else(|| anyhow::anyhow!("categories must contain only strings"))
            })
            .collect::<anyhow::Result<Vec<_>>>()?,
        None => Vec::new(),
    };
    let language = match object.get("language") {
        Some(value) => {
            let language = value
                .as_str()
                .map(str::trim)
                .filter(|value| !value.is_empty())
                .ok_or_else(|| anyhow::anyhow!("language must be a non-empty string"))?;
            Some(language.to_string())
        }
        None => None,
    };
    let max_results = match object.get("max_results") {
        Some(value) => {
            let max_results = value
                .as_u64()
                .ok_or_else(|| anyhow::anyhow!("max_results must be a positive integer"))?;
            Some(max_results.clamp(1, MAX_RESULTS as u64) as usize)
        }
        None => None,
    };

    Ok(SearxngSearchArgs {
        query,
        categories,
        language,

View on GitHub (pinned to 7491200858)

Solutions

  1. Pass language as a non-empty BCP-47-style code string, e.g. "en" or "de".
  2. Omit the field entirely to use the SearXNG instance's default language.
  3. Validate/normalize the language value before invoking the tool.
Defensive patterns

Strategy: type-guard

When it happens

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