Skip to content

[Bug] Token usage calculation incorrect for *non-peak* hours with 2 small sessions #40845

Closed as not planned

Description

@sid597

Bug Description
I am on max plan and outside of the peak hours window still my status shows 29% usage, I have 2 sessions open, this one and another with 90k tokens how is this possible to use up 29% what is going on?? I don't have any subagents running aroung

Environment Info

  • Platform: linux
  • Terminal: kitty
  • Version: 2.1.87
  • Feedback ID: 4693ed88-e94b-40e6-bce9-07543f63b25f

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /home/sid/.local/share/claude/versions/2.1.87 (expected in multi-process scenarios)\n    at em$ (/$bunfs/root/src/entrypoints/cli.js:2849:2138)\n    at Ei8 (/$bunfs/root/src/entrypoints/cli.js:2849:1218)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-30T06:40:17.901Z"}]

Activity

  1. yurukusa commented on Mar 30, 2026

    @yurukusa

    The 29% usage with only 90K tokens across 2 sessions suggests either:

    1. Background processes consuming tokens — check for running subagents or MCP servers:
    ps aux | grep -i claude | grep -v grep
    ls /tmp/claude-* 2>/dev/null
    1. Previous sessions still counting — the usage window may include earlier sessions from the same period:
    ls -lt ~/.claude/projects/*/sessions/*.jsonl | head -10
    1. Non-peak hours window may not be what you expect — verify your timezone and the actual peak/non-peak boundaries for your region.
    LOGFILE="$HOME/.claude/token-usage-$(date +%Y%m%d).log"
    echo "$(date +%H:%M:%S) tool_call session=${CLAUDE_SESSION_ID:-unknown}" >> "$LOGFILE"
    exit 0

    This lets you correlate actual tool calls with reported usage to identify phantom token consumption.

  2. marlvinvu commented on Apr 3, 2026

    @marlvinvu

    My Claude says your 29% usage with only 90K tokens across 2 small sessions matches the root cause found in #40584: the client-side rate limiter multiplies estimated context tokens by the number of concurrent sessions. So 2 sessions × your context size = double the token count against your budget. This is counted CLIENT-SIDE before any API call — model: "", input_tokens: 0. The simplest workaround: run one session at a time instead of two concurrent ones. See #40584 for the full analysis with log evidence.

  3. github-actions commented on May 12, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  4. github-actions commented on Jul 1, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  5. locked as resolved and limited conversation to collaborators on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:costbugSomething isn't workingplatform:linuxIssue specifically occurs on LinuxstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions