claude-code - 💡(How to fix) Fix [BUG] The `/usage` command fails to show usage stats (stuck on "Loading usage data...") in sessions that have been idle for some time [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#46763Fetched 2026-04-12 13:33:41
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Exiting and restarting the session allows /usage to start working again, as does sending a message to Claude within the idle session before running /usage. But it's not ideal to need to perform these workarounds just to check usage before continuing an idle session.

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?

Running /usage within a Claude Code session does not show usage stats, if run in a session that's been idle (no messages sent) for a while, e.g. 1-3 hours or more. It gets stuck in a loading state ("Loading usage data..."):

<img width="462" height="212" alt="Image" src="https://github.com/user-attachments/assets/03a9dc39-3bc8-452c-ac65-b7a52c060ef4" />

Exiting and restarting the session allows /usage to start working again, as does sending a message to Claude within the idle session before running /usage. But it's not ideal to need to perform these workarounds just to check usage before continuing an idle session.

What Should Happen?

Running /usage should display usage stats, regardless of how long a session has been idle.

Error Messages/Logs

Steps to Reproduce

  1. Open a Claude Code session
  2. Run /usage and see that it correctly displays usage stats
  3. Leave the session idle for 1-3 hours
  4. Try to run /usage again, and see that it

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.101 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

This is the same bug described in #21637, which was auto-closed by the github-actions bot.

The bug occurs across platforms and apps (Mac, Windows, Terminal.app, iTerm2, VSCode / Cursor integrated shells, etc).

extent analysis

TL;DR

Sending a message to Claude within the idle session before running /usage may temporarily resolve the issue, but a more permanent fix is needed to consistently display usage stats regardless of session idle time.

Guidance

  • Investigate the idle session timeout and its impact on the /usage command to understand why it gets stuck in a loading state.
  • Verify if the issue is related to the Anthropic API or the Claude Code implementation by checking the API documentation and testing the /usage command with different API versions or configurations.
  • Consider implementing a keep-alive mechanism or a periodic refresh of the session to prevent it from becoming idle and causing the /usage command to fail.
  • Review the code changes made in the last working version (if known) to identify potential regressions or fixes that may have introduced this issue.

Notes

The issue seems to be related to the idle session timeout, but without more information about the underlying implementation or API documentation, it's difficult to provide a definitive fix. The fact that sending a message to Claude within the idle session resolves the issue temporarily suggests that the problem may be related to the session state or the API's handling of idle sessions.

Recommendation

Apply workaround: Send a message to Claude within the idle session before running /usage to temporarily resolve the issue, while investigating a more permanent fix to consistently display usage stats regardless of session idle time.

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