anomalyco / anomalyco/opencode
[Bug] reasoning_content "invalid_request" on follow-up messages with OpenCodeZen DeepSeek-V4-Flash in thinking mode
Open
@kitlangton is already working on this.
Since Aug 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When using OpenCodeZen's DeepSeek-V4-Flash with thinking mode enabled, sending a follow-up message within the same session intermittently fails with:
Error from provider (Console): Upstream request failed: [invalid_request_error]
The reasoning_content in the thinking mode must be passed back to the API.
The error breaks tool invocations and upstream requests, interrupting the conversation until the session is restarted.
Steps to reproduce
- Create a new session with OpenCodeZen's DeepSeek-V4-Flash with thinking mode enabled.
- First message works fine.
- Send a second (follow-up) message in the same session while reasoning output is present in the history.
- The error triggers and the conversation is interrupted.
Expected vs actual
- Expected: reasoning_content from history is passed back to the API correctly, or the client omits stale/empty reasoning fields.
- Actual: Request rejected with invalid_request_error; upstream request fails.
Environment - Provider: OpenCodeZen (configured via auth.json)
- Model: DeepSeek-V4-Flash (thinking mode)
- Error type: [invalid_request_error]
Additional notes - Official DeepSeek API does NOT exhibit this issue with the same model — the problem appears specific to the OpenCodeZen gateway's handling of reasoning_content.
- Restarting the session temporarily resolves it, but it reproduces again afterward.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.