NousResearch/hermes-agent

Handling 402 'can only afford N tokens' errors as recoverable

Cluster 49769 · agent. Data as of

Nothing open on GitHub. Fix merged in #134157 on 7 Oct 2026. Check it covers your case.

The short answer

0open issues
0open PRs
4items grouped
Known?
Yes. 4 related items grouped here, 1 issue already closed.
Fix event
A fix was merged to main in PR #134157. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this resolved, deciding PR #133714. That is separate from the fix event.
Still open
Nothing open on GitHub.

Most members concern a 402 response saying only N tokens are affordable, which is described as being treated as terminal billing; two titles propose treating it as recoverable or retrying once with a capped output. One member is a broader test-focused item on provider wire formats, error bodies, and prompt-cache prefixes, which is related but less specific.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #133767 test: pin each provider's wire, real error bodies, and the prompt-cache prefix contract

    merged to main

    files: tests/agent/test_error_classifier_observed.py, tests/agent/test_prompt_cache_prefix_contract.py, tests/agent/transports/test_provider_wire_snapshot.py, tests/fixtures/provider_wire_snapshot.json

  • #134157 fix(agent): a credit-limited 402 retries once with the affordable output cap instead of failing as billing

    merged to main

    files: agent/turn_recovery.py, agent/turn_retry_state.py, tests/agent/test_affordable_402_main_loop.py

1 PR closed without merging

From the close comments: done elsewhere 1

  • #49785 fix(error): treat 402 'can only afford N tokens' as recoverable rate-limit · done elsewhere → ee8dd6c, #134157
Closed issues · 1
  • Closed#49769Recoverable 402 ("can only afford N tokens") is treated as terminal billing and drops the request
How this cluster was grouped
  • Link evidence (structural links throughout): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
  • Pairwise link density 0.50: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Subsystem
agent
Merged PRs
#133767, #134157
Closed issues
1
Attempts
1 PR closed without merging
Fix link checked
7 Oct 2026

For your agent

The same facts, typed.