hermes - 💡(How to fix) Fix [Bug]: DeepSeek reasoning models not supported (reasoning_content missing) [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15679Fetched 2026-04-26 05:25:52
View on GitHub
Comments
3
Participants
2
Timeline
10
Reactions
1
Author
Participants
Timeline (top)
labeled ×5commented ×3closed ×1cross-referenced ×1

When using DeepSeek thinking models (e.g. deepseek-v4-flash) in Hermes, multi-turn conversations eventually fail with a 400 error:

Error Message

2026-04-25 21:48:03,955 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The reasoning_content in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}} 2026-04-25 21:49:30,567 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The reasoning_content in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}} 2026-04-25 21:52:10,937 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The reasoning_content in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}

Root Cause

Root Cause Analysis (optional)

Code Example

Debug report uploaded:
  Report     https://paste.rs/rxiq7
  agent.log  https://paste.rs/AfuaL

---

2026-04-25 21:48:03,955 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The `reasoning_content` in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
2026-04-25 21:49:30,567 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The `reasoning_content` in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
2026-04-25 21:52:10,937 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The `reasoning_content` in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
RAW_BUFFERClick to expand / collapse

Bug Description

Description

When using DeepSeek thinking models (e.g. deepseek-v4-flash) in Hermes, multi-turn conversations eventually fail with a 400 error:

Additional Context

  • Context size was ~60k tokens when failure occurred
  • Error appears consistently after reasoning is triggered
  • Does not happen with non-thinking models (e.g. OpenAI / standard chat models)

Steps to Reproduce

Reproduction Steps

  1. Set model to deepseek-v4-flash
  2. Start a multi-turn conversation (e.g. via WhatsApp gateway)
  3. Trigger reasoning / long-context interaction
  4. After several turns, Hermes fails with:

Expected Behavior

Expected Behavior

  • Hermes should handle DeepSeek thinking models correctly without causing API errors
  • reasoning_content returned by the model should be preserved and included in subsequent requests
  • Multi-turn conversations should continue to work normally without breaking the session
  • A failed request should not permanently corrupt the session

Actual Behavior

Observed Behavior

  • The error is non-retryable
  • The affected session becomes unusable
  • Other sessions (new users) still work normally

Affected Component

Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

WhatsApp

Debug Report

Debug report uploaded:
  Report     https://paste.rs/rxiq7
  agent.log  https://paste.rs/AfuaL

Operating System

Ubuntu 22.02

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

2026-04-25 21:48:03,955 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The `reasoning_content` in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
2026-04-25 21:49:30,567 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The `reasoning_content` in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
2026-04-25 21:52:10,937 ERROR [20260425_204908_2903cd39] root: Non-retryable client error: Error code: 400 - {'error': {'message': 'The `reasoning_content` in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}

Root Cause Analysis (optional)

Root Cause (Hypothesis)

DeepSeek thinking models return a reasoning_content field in assistant responses.

For subsequent requests, this field must be preserved and passed back as part of the conversation history.

Currently, Hermes appears to:

  • discard or ignore reasoning_content
  • only send content back

This causes DeepSeek to reject the request.

Proposed Fix (optional)

Possible Fix

  • Preserve reasoning_content in assistant messages
  • Allow it through message sanitization
  • Include it only for DeepSeek providers

Happy to submit a PR for this if maintainers confirm the approach.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

Preserve and pass back the reasoning_content field in the conversation history for DeepSeek thinking models to fix the 400 error issue.

Guidance

  • Verify that the reasoning_content field is being discarded or ignored in the current implementation by reviewing the message sanitization and conversation history handling code.
  • Modify the code to preserve the reasoning_content field in assistant messages and include it in subsequent requests for DeepSeek providers.
  • Ensure that the reasoning_content field is properly handled and passed back to the API to prevent the 400 error.
  • Review the debug report and logs to confirm that the issue is resolved after implementing the fix.

Example

No code snippet is provided as the issue does not contain sufficient information about the current implementation.

Notes

The proposed fix assumes that the issue is caused by the lack of preservation and passing back of the reasoning_content field. However, further investigation and verification may be necessary to confirm the root cause.

Recommendation

Apply the workaround by preserving and passing back the reasoning_content field for DeepSeek thinking models, as this is the most likely cause of the issue and a fix has been proposed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Bug]: DeepSeek reasoning models not supported (reasoning_content missing) [3 comments, 2 participants]