zeroclaw-labs/zeroclaw · error

Search query cannot be empty

Error message

Search query cannot be empty

What it means

Input guard in the web search tool's execute path: the 'query' argument is missing from the tool arguments or is not a string. A WARN log with the failing parameter name is recorded before the error. Downstream result parsing (DuckDuckGo/Tavily/Jina/Bocha/Brave/Searxng) can only run with a real query, so the tool fails fast. Pass a non-empty 'query' string.

Solutions

  1. Pass a non-empty search query string to the web_search tool.
  2. Trim the query but ensure at least one non-whitespace character remains.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:1116 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/4f4b93e033ee6170. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:1116

            },
            "required": ["query"]
        })
    }

    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        let query = args.get("query").and_then(|q| q.as_str()).ok_or_else(|| {
            ::zeroclaw_log::record!(
                WARN,
                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)
                    .with_attrs(::serde_json::json!({"param": "query"})),
                "web_search: missing query parameter"
            );
            anyhow::Error::msg("Missing required parameter: query")
        })?;

        if query.trim().is_empty() {
            anyhow::bail!("Search query cannot be empty");
        }

        ::zeroclaw_log::record!(
            INFO,
            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
            &format!("Searching web for: {}", query)
        );

        let resolution = resolve_web_search_provider(&self.model_provider);
        if resolution.used_fallback {
            ::zeroclaw_log::record!(
                WARN,
                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)
                    .with_outcome(::zeroclaw_log::EventOutcome::Unknown),
                &format!(
                    "Unknown web search model_provider '{}'; falling back to '{}'",
                    self.model_provider, resolution.canonical_provider
                )

View on GitHub (pinned to 88bb9c8533)