xai-org/grok-build · warning

Required: query (string).

Error message

Required: query (string).

What it means

The workspace_symbol operation requires a query string to search workspace-wide symbols. The manager validates input.query before fanning the request out to all running LSP clients, returning this message when the argument is missing. Like error 760 it is an argument-contract check, not a search failure.

Source

Thrown at crates/codegen/xai-grok-tools/src/implementations/lsp/manager.rs:576

                    _ => unreachable!(),
                }
            }
            LspOperation::DocumentSymbol => {
                let Some(ref file_path) = input.file_path else {
                    return err("Required: file_path (string).".into());
                };
                let path = PathBuf::from(file_path);
                let Some(client) = self.client_for_file_mut(&path) else {
                    return err(format!("No LSP server configured for {}", path.display()));
                };
                client
                    .document_symbols(&path)
                    .await
                    .map(|s| format_symbols(&s))
            }
            LspOperation::WorkspaceSymbol => {
                let Some(ref query) = input.query else {
                    return err("Required: query (string).".into());
                };
                if self.clients.is_empty() {
                    return err("No LSP servers are running.".into());
                }
                let mut all_symbols = Vec::new();
                let mut last_err = None;
                for client in self.clients.values_mut() {
                    match client.workspace_symbols(query).await {
                        Ok(symbols) => all_symbols.extend(symbols),
                        Err(e) => {
                            last_err = Some(e);
                        }
                    }
                }
                if all_symbols.is_empty() {
                    match last_err {
                        Some(e) => Err(e),
                        None => Ok(format_symbols(&[])),

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Re-issue the call with query as a non-empty string (e.g. "Manager" or "parse_").
  2. Ensure the caller's schema requires query for workspace_symbol.
  3. If the search text is user-supplied, validate it is present and non-empty before dispatching.

Example fix

// before
{ "operation": "workspace_symbol" }
// after
{ "operation": "workspace_symbol", "query": "dispatch_tool" }
Defensive patterns

Strategy: validation

Validate before calling

function validateWorkspaceSymbolArgs(input) {
  if (typeof input.query !== 'string' || input.query.trim().length === 0) {
    throw new Error('workspace_symbol requires a non-empty query string');
  }
  return true;
}

Type guard

function hasQuery(input): input is { query: string } & typeof input {
  return typeof (input as any).query === 'string' && (input as any).query.trim().length > 0;
}

Prevention

When it happens

Trigger: Calling the lsp tool with operation "workspace_symbol" but omitting query, passing query: null, or an agent emitting a call without the search text.

Common situations: Agents constructing tool calls that leave optional-looking fields unset; UI layers that allow submitting the search with an empty/absent query box; schema drift making query optional in the caller's client.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/b6c14defcbc13e03. Report an issue: GitHub.