claude-code - 💡(How to fix) Fix [BUG] Abnormal Token Consumption and Hard Limit Failure Leading to Unexpected $10 Charge (Claude Code) [1 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
anthropics/claude-code#54552Fetched 2026-04-30 06:42:32
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

Please review the backend and session logs for the specified timeframe to investigate the root cause (e.g., agent infinite loop, context window handling error).

Error Messages/Logs

Root Cause

Please review the backend and session logs for the specified timeframe to investigate the root cause (e.g., agent infinite loop, context window handling error).

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

  1. Issue Summary While using Claude Code, my usage rapidly hit 80% of my plan limit within just 5 minutes after a session refresh. Furthermore, the usage exceeded the 100% threshold without triggering any automatic cutoff or safety guardrails, resulting in an unexpected and unauthorized $10 overage charge.

  2. Occurrence Details & Account Info

    Date & Time: Wednesday, April 29, 2026, approx. 14:00 ~ 14:30 (KST)

    Location: Seongnam-si, Gyeonggi-do, South Korea

    Environment: Claude Code opus 4.7

  3. Timeline & Steps to Reproduce

    ~14:00 KST: Received a user permission request while executing tasks in Claude Code.

    Action: I approved the permission request, which triggered a session refresh.

    ~14:05 KST (5 mins after refresh): While Claude Code continued its tasks, the usage abnormally spiked, reaching 80% of my plan limit in an unreasonably short time.

    Subsequent Issue: The process did not halt upon reaching 100%. The system bypassed the hard limit, continuing to consume tokens and resulting in an automatic additional charge of $10.

  4. Action Requested

    Please review the backend and session logs for the specified timeframe to investigate the root cause (e.g., agent infinite loop, context window handling error).

    Issue a refund or grant account credits for the $10 overage charge caused by this system failure.

    Verify and fix the hard-limit safeguard to prevent this from happening again.

What Should Happen?

Expected vs. Actual Behavior

Expected Behavior: * A new session should not consume 80% of a plan limit in 5 minutes under normal operations; there should be protections against infinite agent loops or token calculation errors.

    The system must enforce a strict hard limit at 100% usage and halt operations to prevent unexpected billing, unless explicit prior consent is given.

Actual Behavior: * A severe token leak or runaway loop occurred.

    The billing guardrails failed to activate, leading to a $10 overage.

Error Messages/Logs

Steps to Reproduce

Timeline & Steps to Reproduce

Step 1: During an ongoing session in Claude Code, I entered the following prompt:

    "이슈는 폐기하자. train_v3 학습해보자. local pc가 비어있어." > (Translation: "Let's discard the issue. Let's run train_v3 training. The local pc is empty.")

Step 2: Following this prompt, Claude Code requested user permission to proceed with the requested task (likely to execute the training or explore the local environment).

Step 3: I approved this permission request at approximately 14:00 KST, which triggered a session refresh.

Step 4: Within just 5 minutes of this approval (by 14:05 KST), the token usage skyrocketed to 80% of my plan limit. The incident occurred exactly between the messages before and after the prompt mentioned in Step 1.

Step 5: The agent continued running the task without hitting a hard limit, eventually exceeding 100% usage and causing an unexpected $10 automatic charge.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

opus 4.7

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

No response

extent analysis

TL;DR

The most likely fix involves investigating and resolving the token leak or runaway loop causing the severe usage spike after a session refresh in Claude Code opus 4.7.

Guidance

  • Review the backend and session logs for the specified timeframe (April 29, 2026, 14:00-14:30 KST) to identify the root cause, such as an agent infinite loop or context window handling error.
  • Verify the implementation of the hard-limit safeguard to ensure it correctly halts operations at 100% usage and prevents unexpected billing.
  • Investigate recent changes in Claude Code opus 4.7 that may have introduced the regression, comparing it to the last known working version.
  • Test the system with the same prompt and approval process to reproduce the issue and observe if the fix resolves the token leak or loop.

Example

No specific code snippet can be provided without direct access to the Claude Code or Anthropics API, but the investigation should focus on the token usage calculation and the hard limit enforcement mechanisms.

Notes

The exact cause of the token leak or loop is uncertain without further log analysis or debugging. The solution may involve updating the Claude Code version if a fix is available or applying a temporary workaround to prevent similar overages.

Recommendation

Apply a workaround to closely monitor and manually limit token usage until the root cause is identified and a permanent fix is implemented, as the current version (opus 4.7) seems to have a regression causing the issue.

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

claude-code - 💡(How to fix) Fix [BUG] Abnormal Token Consumption and Hard Limit Failure Leading to Unexpected $10 Charge (Claude Code) [1 comments, 2 participants]