anomalyco / anomalyco/opencode

Response text leaks into tool call parameters — malformed API calls with prose as parameter values

Open
#42,359 3 comments 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 13, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When using local models (tested: qwen3.6-27b-mtp), opencode incorrectly parses model response text as tool call parameters. The parser appears to detect a tool name in the output, then captures surrounding prose as parameter values instead of treating it as plain text.

Observed behavior:

Tool calls appear with libraryId or other parameters containing my actual response prose (e.g., "Library ID: /function_calls> block.\n\n**fixes applied..."`)
Results in invalid API errors like Invalid library ID format or Library not found
Happens spontaneously during normal conversation — no user action triggers it
Occurs across multiple sessions, started after updating to latest version today
Expected behavior: Response text should be displayed as output. Tool calls should only be invoked when the model explicitly emits a tool call structure with valid parameters.

Environment
Model: qwen3.6-27b-mtp (local, via LM Studio localhost:1234)
OS: Windows 11
MCP Servers: context7 (documentation lookup)
opencode version: Latest (updated today)

Additional Notes
This appears to be a stream parsing issue where the boundary between "text output" and "tool call invocation" is not being correctly identified. The parser may be over-eagerly matching tool names within prose content, then capturing adjacent text as parameters.

Plugins

opencode-working-memory

OpenCode version

No response

Steps to reproduce

Steps to Reproduce
Start opencode with a local model (qwen3.6-27b-mtp via LM Studio)
Engage in multi-turn conversation involving code analysis or documentation lookup
After several exchanges, observe malformed tool calls where parameter values contain the model's prose response text rather than actual parameter data
The error appears as Invalid library ID format or similar validation failures on tools like context7_query_docs

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

opencode desktop

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.