Skip to content

Conversation

@purelledhand
Copy link

Summary

  • Fix stack overflow error when users have 65k+ JSONL files in ~/.claude/projects
  • Replace spread operator with for loop to avoid call stack limit

Problem

Users with many JSONL files (100k+) see "No usage history found" even though files exist.

Root cause: allFiles.push(...files) causes "Maximum call stack size exceeded" when the array has more than ~65,536 elements. The catch block silently swallows this error, making it appear as if no files were found.

Solution

Replace the spread operator with a for loop:

// Before (causes stack overflow with large arrays)
allFiles.push(...files);

// After (safe for any array size)
for (const file of files) allFiles.push(file);

Testing

Tested with 106,000+ JSONL files:
- Before fix: "No usage history found"
- After fix: "Found 145,074 usage entries" 

gn00295120 added a commit to gn00295120/claude-code-leaderboard that referenced this pull request Dec 31, 2025
- Map Claude 4.5 model names to backend-supported equivalents
  (backend API doesn't recognize new model IDs yet)
- Fix stack overflow when scanning 65k+ JSONL files (PR grp06#17)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant