hermes - 💡(How to fix) Fix [Bug]: Fallback fails with NameError when primary provider (DeepSeek) runs out of tokens [3 pull requests]

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

Operating System

Ubuntu 24.04

Python Version

Python: 3.11.15

Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

Code Example

model:
  default: deepseek-v4-flash
  provider: deepseek
  base_url: https://api.deepseek.com/v1

fallback_providers:
  - provider: openrouter
    model: openrouter/free
    base_url: https://openrouter.ai/api/v1

### Steps to Reproduce

Set DeepSeek as primary provider with an API key that has 0 remaining balance

Add OpenRouter as fallback: hermes fallback add → select openrouter

Verify fallback is configured: hermes fallback list shows the chain

Send any message to Hermes

Hermes crashes with NameError instead of falling back

### Expected Behavior

When DeepSeek returns a rate-limit or quota-exhausted error, Hermes should:

Detect the failure as a fallback-triggering condition (429/402/auth failure)

Resolve credentials for the fallback provider (OpenRouter)

Switch to the fallback model seamlessly

Continue the conversation using the fallback provider

As documented: https://hermes-agent.nousresearch.com/docs/user-guide/features/fallback-providers

### Actual Behavior

Hermes crashes immediately with:

Sorry, I encountered an error (NameError). name '_pool_may_recover_from_rate_limit' is not defined Try again or use /reset to start a fresh session.

The fallback chain is never attempted. The session becomes unusable. The function _pool_may_recover_from_rate_limit appears to be referenced but not defined/imported in the current code path — likely a missing import or a function removed/renamed during a refactor without updating all call sites.

### Affected Component

Other

### Messaging Platform (if gateway-related)

Telegram, N/A (CLI only)

### Debug Report

---

### Operating System

Ubuntu 24.04

### Python Version

Python: 3.11.15

### Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

### Additional Logs / Traceback (optional)
RAW_BUFFERClick to expand / collapse

Bug Description

Fallback provider fails to activate when primary provider (DeepSeek) exhausts API quota. Instead of switching to the configured fallback (OpenRouter), Hermes crashes with an internal NameError referencing an undefined function in the credential pool logic.

Error: Sorry, I encountered an error (NameError). name '_pool_may_recover_from_rate_limit' is not defined Try again or use /reset to start a fresh session.

Config:

model:
  default: deepseek-v4-flash
  provider: deepseek
  base_url: https://api.deepseek.com/v1

fallback_providers:
  - provider: openrouter
    model: openrouter/free
    base_url: https://openrouter.ai/api/v1

### Steps to Reproduce

Set DeepSeek as primary provider with an API key that has 0 remaining balance

Add OpenRouter as fallback: hermes fallback add → select openrouter

Verify fallback is configured: hermes fallback list shows the chain

Send any message to Hermes

Hermes crashes with NameError instead of falling back

### Expected Behavior

When DeepSeek returns a rate-limit or quota-exhausted error, Hermes should:

Detect the failure as a fallback-triggering condition (429/402/auth failure)

Resolve credentials for the fallback provider (OpenRouter)

Switch to the fallback model seamlessly

Continue the conversation using the fallback provider

As documented: https://hermes-agent.nousresearch.com/docs/user-guide/features/fallback-providers

### Actual Behavior

Hermes crashes immediately with:

Sorry, I encountered an error (NameError). name '_pool_may_recover_from_rate_limit' is not defined Try again or use /reset to start a fresh session.

The fallback chain is never attempted. The session becomes unusable. The function _pool_may_recover_from_rate_limit appears to be referenced but not defined/imported in the current code path — likely a missing import or a function removed/renamed during a refactor without updating all call sites.

### Affected Component

Other

### Messaging Platform (if gateway-related)

Telegram, N/A (CLI only)

### Debug Report

```shell
Debug report uploaded:
  Report       https://paste.rs/DojmB
  agent.log    https://paste.rs/J7kJC
  gateway.log  https://paste.rs/zV2nm

Operating System

Ubuntu 24.04

Python Version

Python: 3.11.15

Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

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

hermes - 💡(How to fix) Fix [Bug]: Fallback fails with NameError when primary provider (DeepSeek) runs out of tokens [3 pull requests]