claude-code - 💡(How to fix) Fix [Bug] Resumed conversations incorrectly recount context tokens as new usage [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#46047Fetched 2026-04-11 06:30:21
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

Error Message

[{"error":"Error: spawn /data/data/com.termux/files/usr/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-android/rg ENOENT\n at ChildProcess._handle.onexit (node:internal/child_process:286:19)\n at onErrorNT (node:internal/child_process:507:16)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)","timestamp":"2026-04-10T02:29:40.484Z"}]

Code Example

[{"error":"Error: spawn /data/data/com.termux/files/usr/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-android/rg ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:286:19)\n    at onErrorNT (node:internal/child_process:507:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)","timestamp":"2026-04-10T02:29:40.484Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description I am being charged repeatedly for tokens that I have already paid for. When I shut down my terminal and later resume conversations, the context usage of those conversations is getting counted as NEW token usage.

Example: I close my terminal for the day after a single coding session with Opus 4.6-1m. At close, the session was at 750k tokens of my 1,000k window. The next morning, I start my computer, open my terminal, and resume yesterday's session. The bug is that yesterday's 750k-token context is counted AGAIN, as if it were 750k tokens of brand new compute — when it is just yesterday's session context being reloaded into the Claude Code CLI from local storage.

Summary: I spend a cumulative 750k tokens on day 1, close my terminal, resume that conversation from local storage on day 2, and day 2's consumption is immediately billed for 750k tokens. My weekly consumption jumps to 1.5m tokens — I'm being charged for my daily consumption plus my CUMULATIVE CONSUMPTION.

Environment Info

  • Platform: linux
  • Terminal: xterm-256color
  • Version: 2.1.70
  • Feedback ID: dd157abe-cb0c-4815-b323-2379e1b7dc51

Errors

[{"error":"Error: spawn /data/data/com.termux/files/usr/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-android/rg ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:286:19)\n    at onErrorNT (node:internal/child_process:507:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)","timestamp":"2026-04-10T02:29:40.484Z"}]

extent analysis

TL;DR

The issue can be mitigated by implementing a mechanism to track and exclude previously counted token usage when resuming conversations from local storage.

Guidance

  • Investigate the token counting mechanism to identify why it's not distinguishing between new and resumed conversations.
  • Consider implementing a unique conversation ID that persists across sessions to accurately track token usage.
  • Review the local storage data to determine how the conversation context is being reloaded and if there's a way to flag it as a resumed conversation.
  • Analyze the error log to see if the ENOENT error is related to the token counting issue or if it's a separate problem.

Example

No code example is provided as the issue lacks specific details about the implementation.

Notes

The provided error log seems unrelated to the token counting issue, but it's essential to investigate and resolve it to ensure the overall stability of the system.

Recommendation

Apply a workaround by implementing a conversation ID tracking mechanism to exclude previously counted token usage when resuming conversations. This approach can help mitigate the issue until a more permanent fix is available.

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