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
text content blocks must be non-empty when using Claude models and tools #24087
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_
Activity
github-actions commentedon Apr 24, 2026
This issue might be a duplicate of existing issues. Please check:
text content blocks must be non-emptyerror occurring with Claude models and tool usageValidationException: text content blocks must be non-emptyerror (Bedrock variant)If your issue is the same, please add a thumbs-up or comment on the existing issue rather than opening a new one.
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.