Description
Describe the bug
When using OpenCode with any Claude models, I frequently encounter an API error: text content blocks must be non-empty. This error typically occurs during tool usage (like reading files or searching). Once the error appears, the current conversation becomes unusable, and I have to start a completely new session to continue working.
To Reproduce
Steps to reproduce the behavior:
- Start a new session with OpenCode using a Claude model (Sonnet/Opus).
- Ask the agent to perform tasks that involve using tools (e.g., exploring project structure, reading multiple files, or searching).
- The agent attempts to call a tool or respond.
- The error
text content blocks must be non-empty is thrown, and the agent stops responding properly.
Expected behavior
The agent should successfully execute tools and format the API request correctly without sending empty text content blocks to the Anthropic API.
Logs / Error Output
BadRequestError: 400 {"type":"error","error":{"type":"invalid_request_error","message":"text content blocks must be non-empty"}}
at APIError.generate (node_modules/@anthropic-ai/sdk/error.js:...)
at Anthropic.makeRequest (node_modules/@anthropic-ai/sdk/core.js:...)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
<img width="456" height="88" alt="Image" src="https://github.com/user-attachments/assets/e1a3a38d-00b6-4edf-940b-9f99f7f371aa" />
### Plugins
没有
### OpenCode version
最新版
### Steps to reproduce
_No response_
### Screenshot and/or share link
<img width="456" height="88" alt="Image" src="https://github.com/user-attachments/assets/544fdfb6-4bf1-4846-be7a-1150fe60410e" />
### Operating System
w11
### Terminal
_No response_
Description
Describe the bug
When using OpenCode with any Claude models, I frequently encounter an API error:
text content blocks must be non-empty. This error typically occurs during tool usage (like reading files or searching). Once the error appears, the current conversation becomes unusable, and I have to start a completely new session to continue working.To Reproduce
Steps to reproduce the behavior:
text content blocks must be non-emptyis thrown, and the agent stops responding properly.Expected behavior
The agent should successfully execute tools and format the API request correctly without sending empty text content blocks to the Anthropic API.
Logs / Error Output