[BUG] Excessive config file polling during UI render causes full CPU usage when arrow key is pressed to recall previous prompt
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When pressing arrow keys to recall previous prompts (history navigation), Claude Code enters a tight polling loop checking ~/.claude/.config.json approximately 15,000 times per second. This causes 100% CPU usage on one core.
The config file is checked via access() + statx() syscalls on every UI render frame without any caching. This happens regardless of whether the file exists or not.
Key finding: This is NOT caused by a missing file (as suggested in #11170). The polling continues at the same rate even after creating the file.
What Should Happen?
Configuration files should be:
- Read once at startup and cached
- Optionally watched via inotify for changes
- NOT re-read on every render frame
Error Messages/Logs
strace output showing the polling pattern (excerpt from ~10ms window):
read(20, "\33[A", 262144) = 3 ← Arrow Up key press
access("/home/user/.claude/history.jsonl", F_OK) = 0
clone3({flags=CLONE_THREAD...}) = 695753 ← Thread spawned
access("/home/user/.claude/.config.json", F_OK) = 0
statx(AT_FDCWD, "/home/user/.claude/.config.json", ...) = 0
access("/home/user/.claude/.config.json", F_OK) = 0
statx(AT_FDCWD, "/home/user/.claude/.config.json", ...) = 0
madvise(0x..., 16384, MADV_DODUMP) = 0
access("/home/user/.claude/.config.json", F_OK) = 0
statx(AT_FDCWD, "/home/user/.claude/.config.json", ...) = 0
[... repeats ~150 times in 10ms ...]
write(12, "\33[?2026h\33[2K\33[1A...", 2212) = 2212 ← Terminal redraw
The madvise(MADV_DODUMP) calls interleaved with config checks indicate this is tied to the render/memory allocation cycle.
Steps to Reproduce
- Start Claude Code in terminal
- Run strace -f -e trace=access,statx -p $(pgrep -f "claude") in another terminal
- Press Up Arrow to recall previous prompt
- Observe thousands of access("/home/user/.claude/.config.json") calls
Alternative verification:
strace -c -p $(pgrep -f "claude")
Run for a few seconds while pressing arrow keys, observe access and statx dominating syscall counts.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.69
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Xterm
Additional Information
Relationship to other issues
- Issue #11170 reported similar symptoms but misdiagnosed the cause as "non-existent config file". Creating the file does NOT fix the problem - the polling frequency remains the same.
- Issue #2906 (fixed in v1.0.53) addressed similar excessive I/O for settings.json, but .config.json polling was not fixed.
Evidence that file existence doesn't matter
Before creating file (polled ~15,000/sec):
access("/home/user/.claude/.config.json", F_OK) = -1 ENOENT
statx(AT_FDCWD, "/home/user/.claude.json", ...) = 0
[repeats thousands of times]
Note: Falls back from ~/.claude/.config.json to ~/.claude.json
After creating file (STILL polled ~15,000/sec):
access("/home/user/.claude/.config.json", F_OK) = 0
statx(AT_FDCWD, "/home/user/.claude/.config.json", ...) = 0
[repeats thousands of times]
Note: No fallback needed, checks same file
The polling frequency is identical in both cases. Creating the file only changes which file gets statx'd, not how often.
Root cause analysis
The config loading appears to be called synchronously within the UI render loop without caching:
Render cycle:
└─ For each component
└─ loadConfig() ← Called every frame, no cache
└─ render()
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗