claude-code - 💡(How to fix) Fix [BUG] Statusline JSON: rate_limits.five_hour.used_percentage returns epoch timestamp instead of 0/null when 5h window has no data yet [1 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#52326Fetched 2026-04-24 06:10:08
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3subscribed ×1

Error Message

Error Messages/Logs

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?

At the start of a new conversation, when the 5-hour usage window has no data yet, the rate_limits.five_hour.used_percentage field in the statusline JSON input appears to contain the Unix epoch timestamp value (e.g. 1776950400, which is 2026-04-23 00:00:00 UTC — the same value as resets_at) instead of 0, null, or being omitted.

Observed statusline rendering user | ~/path | branch | 󰚩 Opus 4.7 (1M context) | ctx 0% | 5h 1776950400%

What Should Happen?

Either used_percentage: 0, used_percentage: null, or the five_hour object omitted entirely until real data is available.

Error Messages/Logs

Steps to Reproduce

  1. Open a new Claude Code session (subscribed Claude.ai account, not API key).
  2. Use a custom statusline script that reads .rate_limits.five_hour.used_percentage from stdin.
  3. Observe the value on the first few renders before any actual usage accumulates.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

  • Once the window has real data, the field is a normal integer (0–100) as expected.
    • resets_at in the same block holds exactly the value that leaks into used_percentage, suggesting a fallback/initialization bug where the wrong field is read.

extent analysis

TL;DR

The issue can be fixed by initializing the used_percentage field to a default value, such as 0 or null, when there is no data available for the 5-hour usage window.

Guidance

  • Verify that the resets_at field is being used as a fallback value for used_percentage when there is no data available.
  • Check the code that populates the rate_limits.five_hour.used_percentage field to ensure it handles the case where there is no usage data.
  • Consider adding a conditional statement to omit the five_hour object or set used_percentage to a default value when there is no data available.
  • Review the documentation for the Anthropic API to see if there are any specific requirements or recommendations for handling this scenario.

Example

// Example of how the five_hour object could be conditionally included
{
  "rate_limits": {
    "five_hour": {
      "used_percentage": dataAvailable ? actualUsagePercentage : null
    }
  }
}

Notes

The exact fix will depend on the specific implementation details of the Claude Code statusline script and the Anthropic API. Further investigation may be needed to determine the root cause of the issue.

Recommendation

Apply a workaround by initializing the used_percentage field to a default value, such as 0 or null, when there is no data available for the 5-hour usage window. This will ensure that the statusline rendering is accurate and consistent until real data 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

claude-code - 💡(How to fix) Fix [BUG] Statusline JSON: rate_limits.five_hour.used_percentage returns epoch timestamp instead of 0/null when 5h window has no data yet [1 participants]