Code Mode catalog misleads model into calling built-in tools as tools.read inside execute; direct read() works · Issue #57720 · anomalyco/opencode · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Code Mode catalog misleads model into calling built-in tools as tools.read inside execute; direct read() works #57720
On a fresh, clean installation of OpenCode V2.1.2, the model is presented with a tool catalog that lists built-in tools (read, shell, glob, grep, etc.) alongside the execute tool. The execute tool's description instructs: "Call tools through tools using only exact paths and signatures from the catalog." The model therefore reasonably attempts tools.read({ path: '.' }) inside execute, which fails with:
Unknown tool 'read'. Did you mean tools.opencode.read_mcp_resource?
The model then wastes several turns trying variations (tools.shell, tools.glob, checking the catalog again) before eventually discovering that calling read directly (outside execute) works fine:
→Explored: 1 read
→Read .
So the built-in tools are available, they are simply not proxied through tools.* inside execute, and nothing in the catalog or the execute instructions tells the model that. This happens in both Build mode and Plan mode, and regardless of the OPENCODE_EXPERIMENTAL_CODE_MODE flag.
Perform a clean install of OpenCode V2 on a system with no prior V1 installation and no existing ~/.config/opencode, ~/.local/share/opencode, or ~/.cache/opencode.
Start a session in any project directory in Build mode.
Ask the model to inspect the current directory, e.g.:
"Check my project in the current directory, give me your opinion."
Observe the model call execute with tools.read({ path: '.' }).
Observe the failure: Unknown tool 'read'. Did you mean tools.opencode.read_mcp_resource?
Observe the model eventually call readdirectly (not via tools.), which succeeds.
Repeat with OPENCODE_EXPERIMENTAL_CODE_MODE=0 and =true — the misleading catalog and the failed tools.read attempt occur in both cases.
Thanks for the detailed report! I think this is a duplicate of #53623. That issue reports the same thing: the Code Mode instructions lead the model to call built-in tools like read, shell and glob as tools.* inside execute, where they fail with Unknown tool …, when they should be called directly.
Possible duplicates and related issues, ordered from most to least likely:
Activity
opencode-agent commentedon Oct 21, 2026
Thanks for the detailed report! I think this is a duplicate of #53623. That issue reports the same thing: the Code Mode instructions lead the model to call built-in tools like
read,shellandglobastools.*insideexecute, where they fail withUnknown tool …, when they should be called directly.Possible duplicates and related issues, ordered from most to least likely:
executebecause of the Code Mode prompt wording. A maintainer has said the instructions will be adjusted.read,edit,shellandgrepstay top-level and do not exist insideexecute.executehint is added even when Code Mode is denied. This may be why you still saw it withOPENCODE_EXPERIMENTAL_CODE_MODE=0.execute. Today they are deliberately top-level only (see execute: tools.shell unavailable inside Code Mode runtime despite being in catalog #39312).The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.