Skip to content

[Bug]: "Error: Usage refresh failed." #82

Closed

Description

@arhneu

Preflight checklist

  • I searched existing issues and didn't find a duplicate.
  • I'm on the latest version of the extension, or I've written my version below.
  • I read the README's Troubleshooting section (proxies, history retention, the AI advice feature).

What happened?

I am unable to access the Settings panel or view the Usage screen.
It opens with the "Usage refresh failed. Retry or check diagnostic logs." error on the latest version of Claude Code Usage plugin in VS Code.
The Diagnostic Logs don't show any errors but the Developer Tools do:

The Usage bar itself DOES work, fetches and displays the right values:
[11:05:11] fetch: 200 https://api.anthropic.com/api/oauth/usage
[11:05:11] usage: ok — 5h=28%, wk=3%

It's just the main Usage panel that is completely unavailable for me.

console.ts:139 [Extension Host] Error loading usage records: TimestampProbeLimitError: invalid timestamp prefix limit exceeded
	at readEarliestTimestamp (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\claudeUsageFiles.js:143:35)
	at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
	at async c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\claudeUsageFiles.js:173:13
	at async run (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\claudeUsageFiles.js:99:29)
	at async Promise.all (index 2)
	at async mapWithConcurrency (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\claudeUsageFiles.js:102:5)
	at async sortUsageFilesByEarliestTimestamp (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\claudeUsageFiles.js:170:21)
	at async ClaudeDataLoader.loadUsageRecords (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\dataLoader.js:472:28)
	at async ClaudeCodeUsageExtension.runRefresh (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\extension.js:1003:28)
	at async ClaudeCodeUsageExtension.refreshData (c:\Users\archo\.vscode\extensions\growthjack.claude-code-usage-2.2.1\out\extension.js:892:9)

What did you expect instead?

Usage element doesn't work at all since installation. I expected it to open.

Steps to reproduce

  1. Open the Dashboard. It doesn't open. :(

Extension version

2.2.1

Claude Code version

No response

VS Code version

1.130.0

Operating system

Windows

Model / proxy setup

native Anthropic

Diagnostic logs

[11:06:47] fetch: 200 https://api.anthropic.com/api/oauth/usage
[11:06:47] usage: ok — 5h=28%, wk=3%
refresh: trigger=focus files(discovered=937 changed=937 reused=0 removed=0 failed=1) io(bytes=0 lines=0) events(watcher=0 coalesced=0) ms(manifest=68.8 read-parse=88.1 aggregate-render=0.0 total=158.5)
refresh: trigger=poll files(discovered=937 changed=937 reused=0 removed=0 failed=1) io(bytes=0 lines=0) events(watcher=0 coalesced=0) ms(manifest=53.1 read-parse=99.0 aggregate-render=0.0 total=153.5)
refresh: trigger=focus files(discovered=937 changed=937 reused=0 removed=0 failed=1) io(bytes=0 lines=0) events(watcher=0 coalesced=0) ms(manifest=54.6 read-parse=119.1 aggregate-render=0.0 total=175.3)
refresh: trigger=focus files(discovered=937 changed=937 reused=0 removed=0 failed=1) io(bytes=0 lines=0) events(watcher=0 coalesced=0) ms(manifest=54.1 read-parse=107.5 aggregate-render=0.0 total=163.1)
refresh: trigger=focus files(discovered=937 changed=937 reused=0 removed=0 failed=1) io(bytes=0 lines=0) events(watcher=0 coalesced=0) ms(manifest=66.3 read-parse=100.1 aggregate-render=0.0 total=167.8)

Anything else?

Image

Activity

  1. github-actions commented on Jul 29, 2026

    @github-actions

    🤖 Automated first-pass reply

    TL;DR

    A specific JSONL file in ~/.claude/projects has more than 1 MB of initial lines that lack a parsable "timestamp" string. The readEarliestTimestamp probe gives up with TimestampProbeLimitError, which crashes the entire usage-load pipeline. The status-bar usage bar works because it uses the separate OAuth API path.

    Analysis

    • The error originates in src/claudeUsageFiles.ts:readEarliestTimestamp. It opens each JSONL file, reads line by line looking for the first line with a valid JSON timestamp. If it doesn’t find one within MAX_COMPLETED_INVALID_PREFIX_BYTES (1 MiB) of initial lines, it throws TimestampProbeLimitError.
    • That error is not caught in sortUsageFilesByEarliestTimestamp → ClaudeDataLoader.loadUsageRecords → refreshData. One bad file poisons the whole load, so the dashboard never renders.
    • The diagnostic log shows failed=1 among 937 files, matching a single problematic file.

    Suggested next step(s)

    Immediate workaround

    Find the offending JSONL file — likely a corrupted or unusually large session log — and move it out of ~/.claude/projects/**. A quick way to spot it:

    find ~/.claude/projects -name '*.jsonl' -size +1M

    Look at the first few lines of any large candidate. If the opening lines aren’t valid JSON objects with a timestamp field, that’s likely the culprit. Moving it aside should let the dashboard open.

    Proper fix

    sortUsageFilesByEarliestTimestamp should catch TimestampProbeLimitError, log the skipped path (redacted for privacy), and fall back to the file’s mtimeMs (already available in the UsageFileFingerprint) as a surrogate timestamp. That way a single corrupt file cannot block the whole panel.

    If you’re comfortable with a code change, the catch would go in src/claudeUsageFiles.ts ≈ line 171:

    try {
      result = await readEarliestTimestamp(entry.path);
    } catch (e) {
      if (e instanceof Error && e.name === 'TimestampProbeLimitError') {
        // fall through to use mtimeMs below
        result = { timestampMs: 0, bytesRead: 0 };
      } else {
        throw e;
      }
    }

    and then use result.timestampMs || entry.mtimeMs when sorting.

    If you’d prefer a pre-built fix, please confirm your VS Code and OS versions (already listed) and we can prepare a patch release.


    🤖 Generated by DeepSeek as an automated first pass — not a maintainer decision.

  2. Carl723000 commented on Aug 1, 2026

    @Carl723000
    Collaborator

    The reported TimestampProbeLimitError is fixed by the merged contributor PR #79 and is scheduled for v2.2.2.

    The fix makes timestamp probing fail soft for one problematic JSONL file instead of aborting the entire dashboard load, while preserving the established file ordering for the remaining records. Thank you for providing the exact Extension Host stack and anonymous refresh diagnostics; they made the failure reproducible.

    We will keep this issue open until v2.2.2 is published and you have had a chance to confirm that the Usage and Settings panels open normally.


    🤖 Generated with OpenAI Codex

  3. Carl723000 commented on Aug 7, 2026

    @Carl723000
    Collaborator

    v2.2.2 has now been released with the merged contributor fix from #79. A single unusual or unprobeable JSONL file now fails soft instead of aborting the entire Usage and Settings dashboard load.

    I’m closing this as fixed in v2.2.2. If you can still reproduce TimestampProbeLimitError on v2.2.2, please reopen the issue and add the latest anonymous refresh: lines.


    🤖 Generated with OpenAI Codex

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions