Skip to content

Bug Report: invalid internal tool is exposed and can spam repeated calls #21900

Closed as not planned

Description

@Jonathan523

Description

Summary

OpenCode Desktop exposes an internal fallback tool named invalid in user-facing error output. In some sessions, one malformed tool call can cascade into many repeated invalid call entries, which floods the UI and makes debugging difficult.

Environment

  • OpenCode Desktop: 1.4.3
  • Platform: Windows
  • Install source: Scoop

Actual behavior

  • Error messages may show:
Model tried to call unavailable tool ''. Available tools: invalid, question, bash, read, ...
  • The UI may then show many repeated invalid tool-call entries.
Image

Expected behavior

  • invalid should remain internal and never appear in user-facing available tool lists.
  • A malformed tool call should fail once, or be circuit-broken quickly, instead of repeating dozens of times.

Investigation

This does not appear to come from user config. Local config files did not define any invalid tool.

Evidence from the desktop runtime shows:

  • An internal tool is explicitly defined:
...\opencode-cli.exe: InvalidTool = Tool2.define("invalid", ...)
  • Normal active tools already exclude it:
activeTools: Object.keys(tools).filter((x) => x !== "invalid")
  • But unavailable-tool error messages still print an available tools list that includes invalid:
Model tried to call unavailable tool '${toolName}'. Available tools: ${availableTools.join(", ")}

Likely issue

The runtime seems to filter invalid out of normal active tools, but not out of the error/reporting path. That leaks an internal tool into user-facing output. When the model emits malformed tool calls, the fallback path may repeatedly rewrite them into invalid, causing UI spam.

Requested fix

  1. Filter invalid out of all user-facing available-tool lists, including error messages.
  2. Treat invalid as strictly internal and do not surface it as a normal tool.
  3. Add a circuit breaker so repeated malformed tool calls do not produce dozens of invalid entries.

Preferred result after fix

Instead of:

Model tried to call unavailable tool ''. Available tools: invalid, question, bash, read, ...

It should be:

Model tried to call unavailable tool ''. Available tools: question, bash, read, ...

And the session should show at most one or very few failure entries, not a long invalid spam sequence.

Plugins

oh-my-openagent

OpenCode version

1.4.3

Steps to reproduce

  1. Launch OpenCode Desktop 1.4.3
  2. Start a session with normal tool access enabled
  3. Ask the model to perform a relatively complex tool workflow, especially:
  4. multiple tool calls in one response
  5. parallel tool usage
  6. complex argument structures
  7. Once the model emits a malformed tool call (common symptom: empty tool name '', or invalid tool name / argument shape)
  8. Watch the UI / tool call log

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

OpenCode Desktop

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    webRelates to opencode on web / desktop
    on Apr 10, 2026
  2. github-actions commented on Apr 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. removed
    bugSomething isn't working
    webRelates to opencode on web / desktop
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. nabilfreeman commented on May 12, 2026

    @nabilfreeman
    Contributor

    I think this is the same issue I'm experiencing. Can't tell if it's Opus 4.7, or a recent update to Opencode, but the issue is definitely more pronounced in recent weeks.

    When this happens in a subagent, the agent is permanently disabled.

    Image
  5. pjohnston commented on Jun 6, 2026

    @pjohnston

    Hitting this from a different angle — Anthropic claude-code provider (opencode-claude-code-plugin), not desktop / not an open-source model, so worth adding as a second repro context.

    Setup

    • opencode + claude-code provider, model claude-opus-4-7
    • Tool surface includes Anthropic's "deferred tools" pattern — tools like RemoteTrigger, WebFetch, TaskCreate, and all mcp__claude_ai_*__* connectors are not in the default tool list; the model loads schemas on demand via a ToolSearch select:<name> call.

    Symptom

    • After a context summarization / compaction, previously-loaded deferred tool schemas drop out of the model's working tool set.

    • On the next turn the model attempts the call directly (it "remembers" the tool worked earlier), and opencode prints:

      invalid [tool=RemoteTrigger, error=Model tried to call unavailable tool 'RemoteTrigger'. <full available-tools list dumped here>
      
    • The model then recovers (re-fetches the schema, retries), and the user-facing call eventually succeeds. So the error is purely cosmetic — but it's loud and includes the entire available-tools list, which dwarfs the actual response.

    Why this matters even when not using open-source models

    This is the documented Anthropic pattern for keeping the tool schema cheap. Deferred-tool drops after compaction are expected; the harness recovery is by design. opencode rendering each one as a top-level error is the part that's wrong.

    Asks (echoing the original report and adding one)

    1. Filter the invalid internal tool out of user-facing output (per the original report).
    2. Treat "tool not in current schema but recoverable on next turn" as a debug-level event, not an error-level one — logLevel: WARN should hide it.
    3. (Optional) Truncate the available-tools list dump in any user-visible rendering — listing 100+ tools in a terminal error is the biggest contributor to the perceived spam.

    Happy to provide a sanitized session transcript if helpful.

  6. github-actions commented on Aug 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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