hermes - 💡(How to fix) Fix [Bug]: Provider/LLM switch leaves stale encrypted_content causing 400 errors on Telegram sessions

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…

Error Message

When anything gets written in Telegram to bot, this error appears twice in a row -

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fix / Workaround

Session continues to carry the incompatible encrypted blobs. Manual workaround: set "suspended": true on the session key in sessions.json and restart the gateway.

Code Example

Report       https://paste.rs/07AHe
  agent.log    https://paste.rs/VdKj4
  gateway.log  https://paste.rs/AGRvT

---
RAW_BUFFERClick to expand / collapse

Bug Description

When switching providers mid-session (e.g. openai-codex → xai-oauth / grok-4.3), the active Telegram session retains encrypted_content reasoning blobs from the previous provider. xAI cannot decrypt OpenAI blobs, so every subsequent request fails with HTTP 400 before the model ever sees the message.

Would be happy to test a fix.

Steps to Reproduce

1. Start a Telegram session with an OpenAI-based provider.
2. Switch the active model to an xAI provider via hermes model or config.
3. Send any message through the Telegram gateway.
4. Gateway returns 400; the session is now poisoned.

Expected Behavior

Hermes should automatically handle provider changes by either: - Clearing or stripping provider-specific encrypted_content / reasoning blobs on provider switch, or - Isolating sessions by provider (so a switch naturally starts fresh context for the new provider), or - Detecting the mismatch and forcing a new session for that chat.

Actual Behavior

When anything gets written in Telegram to bot, this error appears twice in a row -

⚠️ The model provider failed after retries. I kept raw provider details out of chat; check gateway logs for diagnostics.

Session continues to carry the incompatible encrypted blobs. Manual workaround: set "suspended": true on the session key in sessions.json and restart the gateway.

- Affects gateway sessions (especially Telegram DMs).
- The issue only surfaces on future request after the provider change.
- Related files: gateway/run.py, session store (hermes_state.py), and how encrypted_content is persisted per message.

Affected Component

Other, Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

Report       https://paste.rs/07AHe
  agent.log    https://paste.rs/VdKj4
  gateway.log  https://paste.rs/AGRvT

Operating System

Ubuntu 24.04

Python Version

Python 3.11.5

Hermes Version

Hermes Agent v0.15.0 (2026.5.28)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

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

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