Description
Problem
When a model selects a valid tool but emits malformed or truncated input for that tool, the failure can be routed through the invalid tool in a way that looks similar to an unknown tool call.
This makes it harder to distinguish between two different cases:
- the model called a tool that does not exist
- the model called a valid tool, but the tool input was malformed or could not be parsed
Expected behavior
These cases should be distinguishable in the invalid-tool result, so users and maintainers can tell whether the problem was an unavailable tool or malformed input for an available tool.
Why this matters
The two cases require different follow-up behavior:
- unknown tool: the model/tool registry mismatch should be surfaced clearly
- known tool with malformed input: the model should retry with valid input or split a large/truncated operation into smaller chunks
Related PR
I have a small fix ready that classifies these cases separately.
Plugins
none
OpenCode version
dev branch / source build from anomalyco/opencode dev at 5720883, with fix branch based on that commit
Steps to reproduce
- Have a model call an existing OpenCode tool, but with malformed or truncated JSON input.
- Observe that the failure is routed through the
invalid tool.
- Compare this with a model calling a tool that does not exist.
- Both cases are hard to distinguish from the invalid-tool result, even though they mean different things.
Screenshot and/or share link
PR: #25788
Operating System
macOS 26.4 locally; also reproduced/validated on Debian 12 test host
Terminal
iTerm2 locally; OpenCode web UI/browser for manual validation
Description
Problem
When a model selects a valid tool but emits malformed or truncated input for that tool, the failure can be routed through the
invalidtool in a way that looks similar to an unknown tool call.This makes it harder to distinguish between two different cases:
Expected behavior
These cases should be distinguishable in the invalid-tool result, so users and maintainers can tell whether the problem was an unavailable tool or malformed input for an available tool.
Why this matters
The two cases require different follow-up behavior:
Related PR
I have a small fix ready that classifies these cases separately.
Plugins
none
OpenCode version
dev branch / source build from anomalyco/opencode dev at 5720883, with fix branch based on that commit
Steps to reproduce
invalidtool.Screenshot and/or share link
PR: #25788
Operating System
macOS 26.4 locally; also reproduced/validated on Debian 12 test host
Terminal
iTerm2 locally; OpenCode web UI/browser for manual validation