Skip to content

fix: detect claude individual spend limit in default patterns - #426

Merged
umputun merged 2 commits into
masterfrom
fix-individual-spend-limit-pattern
Aug 7, 2026
Merged

umputun merged 2 commits into
masterfrom
fix-individual-spend-limit-pattern

Conversation

@umputun

@umputun umputun commented Aug 7, 2026

Copy link
Copy Markdown
Owner

claude code emits You've hit your individual spend limit · run /usage-credits to raise it, or visit claude.ai/admin-settings/usage on team plans when a member's extra-usage budget runs out. That wording is not a superstring of any existing default: "individual spend" sits between "your" and "limit", so You've hit your limit cannot substring-match it.

result is the failure from #425 - patternError returns nil and the run dies with the raw claude exited with error: command wait: exit status 1 instead of a limit diagnostic.

add the string to both default lists, same shape as d70c894 (#361, session limit) and 3c461d3 (#336, org monthly limit): claude_error_patterns for a graceful exit when --wait is not set, claude_limit_patterns so wait_on_limit retries through the reset window.

on whether a spend cap belongs in the limit list: 3c461d3 already put the org monthly quota there, with the stated reason that wait_on_limit should retry through a monthly reset window. A team-plan individual spend cap is the same class, and --wait stays opt-in.

the phrase is long and specific, so it doesn't reintroduce the narrated-prose false positives fixed in #419/#321.

second commit is unrelated to the fix itself but was turned up while making it: CLAUDE.md claimed the claude_error_patterns defaults live in llms.txt, which carries the limit-pattern defaults only. The error list is mirrored in the README table instead. That line is the map a pattern addition follows, so the wrong pointer would send the next one to a file with nothing to update.

covered by two TestMatchPattern cases - one pins that the older entries genuinely miss this wording, one pins that the new string matches the real message including its · separator and trailing text.

Related to #425

umputun added 2 commits August 7, 2026 02:24
claude code emits "You've hit your individual spend limit · run /usage-credits
to raise it" on team plans when a member's extra-usage budget is exhausted.
"individual spend" sits between "your" and "limit", so the existing
"You've hit your limit" default cannot substring-match it. patternError
returned nil and the run died with the raw "claude exited with error:
command wait: exit status 1" instead of a limit diagnostic.

add the wording to both default lists, mirroring 3c461d3 and d70c894:
claude_error_patterns for a graceful exit when --wait is not configured, and
claude_limit_patterns so wait_on_limit retries through the reset window.

the phrase is long and specific, so it does not reintroduce the narrated-prose
false positives fixed in #419 and #321.

Related to #425
CLAUDE.md said the claude_error_patterns / codex_error_patterns defaults live in
"llms.txt and the embedded config". llms.txt carries the limit-pattern defaults
only — the error-pattern list appears nowhere in it, and the file that does
mirror it is the README config table.

the line is the map a pattern addition follows, so the wrong pointer sends the
next contributor to a file that has nothing to update and leaves the README
table advertising a default list that no longer ships.

name the actual carriers on both lines: embedded config plus the README table,
and llms.txt for limit patterns only.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ralphex’s default Claude pattern detection so a newer Claude Code quota message (“You’ve hit your individual spend limit …”) is treated as a limit/error pattern, enabling correct diagnostics and optional --wait retry behavior.

Changes:

  • Add You've hit your individual spend limit to embedded default claude_error_patterns and claude_limit_patterns.
  • Add unit tests covering the miss with older patterns and the match with the new pattern.
  • Fix documentation pointers in CLAUDE.md and update docs/defaults references (README.md, llms.txt).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Updates the documented default claude_error_patterns / claude_limit_patterns to include the new spend-limit string.
pkg/executor/executor_test.go Adds TestMatchPattern cases for the individual spend limit wording (including the · separator).
pkg/config/values_test.go Updates embedded-default expectations to include the new pattern in both Claude error and limit lists.
pkg/config/defaults/config Extends the embedded default config’s claude_error_patterns and claude_limit_patterns values/comments.
llms.txt Updates the documented default Claude limit patterns list to include the new spend-limit string.
CLAUDE.md Corrects where defaults are documented (error patterns not in llms.txt) and clarifies limit-pattern default sources.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@umputun
umputun merged commit 407fe8f into master Aug 7, 2026
5 checks passed
@umputun
umputun deleted the fix-individual-spend-limit-pattern branch August 7, 2026 07:45
vitalijb added a commit to vitalijb/ralphex that referenced this pull request Aug 8, 2026
fix: detect claude individual spend limit in default patterns (umputun#426)
echeg pushed a commit to echeg/loopai that referenced this pull request Sep 24, 2026
…n#426)

* fix: detect claude individual spend limit in default patterns

claude code emits "You've hit your individual spend limit · run /usage-credits
to raise it" on team plans when a member's extra-usage budget is exhausted.
"individual spend" sits between "your" and "limit", so the existing
"You've hit your limit" default cannot substring-match it. patternError
returned nil and the run died with the raw "claude exited with error:
command wait: exit status 1" instead of a limit diagnostic.

add the wording to both default lists, mirroring 3c461d3 and d70c894:
claude_error_patterns for a graceful exit when --wait is not configured, and
claude_limit_patterns so wait_on_limit retries through the reset window.

the phrase is long and specific, so it does not reintroduce the narrated-prose
false positives fixed in umputun#419 and umputun#321.

Related to umputun#425

* docs: name the real carriers of the pattern defaults in CLAUDE.md

CLAUDE.md said the claude_error_patterns / codex_error_patterns defaults live in
"llms.txt and the embedded config". llms.txt carries the limit-pattern defaults
only — the error-pattern list appears nowhere in it, and the file that does
mirror it is the README config table.

the line is the map a pattern addition follows, so the wrong pointer sends the
next contributor to a file that has nothing to update and leaves the README
table advertising a default list that no longer ships.

name the actual carriers on both lines: embedded config plus the README table,
and llms.txt for limit patterns only.

(cherry picked from commit 407fe8f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants