Skip to content

Unknown tool call is not guarded early (model calls non-existent tool despite provided tools) #8166

@qoli

Description

@qoli

Summary

In headless runs, the model can emit tool calls for names not present in the provided tools list (e.g. read_file, view_file, run_command), and Goose only fails later at dispatch with Tool 'x' not found. This causes avoidable turn failures and task interruption.

Environment

  • Goose CLI: 1.29.0
  • Provider: custom OpenAI-compatible endpoint (custom_omlx)
  • Model: Qwen3.5-122B-A10B-Text-mxfp4-mlx
  • toolshim: false

Evidence

  • Request payload includes a non-empty tools array.
  • Model still emits tool calls not in that array.
  • Runtime error examples:
    • Tool 'read_file' not found
    • Tool 'view_file' not found
    • Tool 'run_command' not found

Expected Behavior

If model emits an unknown tool name:

  1. Detect it immediately before dispatch.
  2. Return structured correction to model (valid tool list and/or closest match suggestion).
  3. Retry tool-call turn (bounded retries) instead of hard-failing flow progress.

Actual Behavior

Unknown tool call reaches dispatch and fails with Tool 'x' not found, often breaking task continuity.

Suggested Fix

  • Add guardrail in tool-call handling path:
    • Validate tool name against current advertised tool set before dispatch.
    • On mismatch, inject synthetic tool error response with valid names (or fuzzy suggestion).
    • Allow bounded retry for tool selection.
  • Add telemetry/logging for unknown tool-name rate by provider/model to help track compatibility quality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions