[Bug] Performance Degradation: Persistent Slowdown After PostToolUse:Edit Hook
Bug Description Claude is very very very slow after running a hook that it seems like it freezes. It's not after every hook but seems to accumulate. It seems like it freezes but after leaving it for 30+ minutes it does seem to resume. It definitely isn't the hook causing it as the hook does complete fully. Here's some other observations: Okay so I am able to replicate it repeatedly where it's kinda getting annoying. Some more info:
- it's always after my PostToolUse:Edit.
- Claude is certainly doing something as it's using a bit over 1 cpu when frozen.
- The interface is definitely frozen, pressing enter, escape or even ctrl+c twice doesn't help.
- in the debug log it's after it writes .claude.json:
[DEBUG] Temp file written successfully, size: 182516 bytes
[DEBUG] Applied original permissions to temp file
[DEBUG] Renaming /home/<user>/.claude.json.tmp.3099408.1759236081994 to /home/<user>/.claude.json
[DEBUG] File /home/<user>/.claude.json written atomically
Environment Info
- Platform: linux
- Terminal: gnome-terminal
- Version: 2.0.5
- Feedback ID: c9a5cabc-33ab-4ec2-995a-29fe8388491f
Errors
[{"error":"MaxFileReadTokenExceededError: File content (31002 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n at lBB (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1684:404)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.call (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1679:1010)\n at async QO (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:30497)\n at async file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1757:1322","timestamp":"2025-10-03T14:13:27.404Z"},{"error":"Error: Connection error.\n at yP.makeRequest (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:4466)\n at async TZ1 (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1045:4233)\n at async lBB (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1684:375)\n at async Object.call (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1679:1010)\n at async QO (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:30497)\n at async file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:2145:6860\n at async Promise.all (index 0)\n at async nP6 (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:2145:6547)\n at async DW (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:2145:3253)\n at async Promise.all (index 0)","timestamp":"2025-10-03T14:41:59.187Z"},{"error":"MaxFileReadTokenExceededError: File content (25999 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n at lBB (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1684:404)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.call (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1679:1010)\n at async QO (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:30497)\n at async file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1757:1322","timestamp":"2025-10-03T14:57:50.930Z"},{"error":"MaxFileReadTokenExceededError: File content (30925 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n at lBB (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1684:404)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.call (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1679:1010)\n at async QO (file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:30497)\n at async file:///home/anthony/.nvm/versions/node/v20.19.4/lib/node_modules/@anthropic-ai/claude-code/cli.js:1757:1322","timestamp":"2025-10-03T14:57:56.208Z"},{"error":"MaxFileReadTokenExceededError: File content (30925 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specifi
Note: Error logs were truncated.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/6474
- https://github.com/anthropics/claude-code/issues/5024
- https://github.com/anthropics/claude-code/issues/4869
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
This seems to be a forking problem possibly, here's an strace that I captured when the probllem was happening, this repeats 1000s of times:
mprotect(0x2b5c6e80000, 262144, PROT_READ|PROT_WRITE) = 0
futex(0x5f25394, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x5f25340, FUTEX_WAKE_PRIVATE, 1) = 1
getpid() = 350116
mmap(0x262be7a80000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x262be7a80000
madvise(0x262be7a80000, 483328, MADV_DONTFORK) = 0
munmap(0x262be7ab7000, 258048) = 0
mprotect(0x262be7a80000, 225280, PROT_READ|PROT_WRITE) = 0
mmap(0x1066d2a80000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x1066d2a80000
madvise(0x1066d2a80000, 483328, MADV_DONTFORK) = 0
munmap(0x1066d2ab7000, 258048) = 0
mprotect(0x1066d2a80000, 225280, PROT_READ|PROT_WRITE) = 0
mmap(0x2ef0fd8c0000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x2ef0fd8c0000
madvise(0x2ef0fd8c0000, 483328, MADV_DONTFORK) = 0
munmap(0x2ef0fd8f7000, 258048) = 0
mprotect(0x2ef0fd8c0000, 225280, PROT_READ|PROT_WRITE) = 0
mmap(0x35f640e00000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x35f640e00000
madvise(0x35f640e00000, 483328, MADV_DONTFORK) = 0
munmap(0x35f640e37000, 258048) = 0
mprotect(0x35f640e00000, 225280, PROT_READ|PROT_WRITE) = 0
mprotect(0x3d34e1480000, 262144, PROT_READ|PROT_WRITE) = 0
mprotect(0x3836d68c0000, 262144, PROT_READ|PROT_WRITE) = 0
mprotect(0x2d6cc4f40000, 262144, PROT_READ|PROT_WRITE) = 0
mprotect(0x16ee6d700000, 262144, PROT_READ|PROT_WRITE) = 0
futex(0x5f25394, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x5f25340, FUTEX_WAKE_PRIVATE, 1) = 1
getpid() = 350116
mmap(0x1085fd4c0000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x1085fd4c0000
madvise(0x1085fd4c0000, 483328, MADV_DONTFORK) = 0
munmap(0x1085fd4f7000, 258048) = 0
mprotect(0x1085fd4c0000, 225280, PROT_READ|PROT_WRITE) = 0
mmap(0x2a4061380000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x2a4061380000
madvise(0x2a4061380000, 483328, MADV_DONTFORK) = 0
munmap(0x2a40613b7000, 258048) = 0
mprotect(0x2a4061380000, 225280, PROT_READ|PROT_WRITE) = 0
mmap(0x26d2fbfc0000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x26d2fbfc0000
madvise(0x26d2fbfc0000, 483328, MADV_DONTFORK) = 0
munmap(0x26d2fbff7000, 258048) = 0
mprotect(0x26d2fbfc0000, 225280, PROT_READ|PROT_WRITE) = 0
mmap(0x206ec0940000, 483328, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x206ec0940000
madvise(0x206ec0940000, 483328, MADV_DONTFORK) = 0
munmap(0x206ec0977000, 258048) = 0
I've attached a node profiling (--prof) run from claude processed.txt
Looking at a trace, this seems to be a memory problem. It seems to do quite abit of GC
This seems to be a problem with node 20, when using node 22 it seems to no longer be an issue (so far). I will update this issue if I run into it again on node 22.
Nope it came back, it just took a lot longer to manifest, to be clear I'm not using one long conversation. I do /clear quite often ususally around 80k-120k token usage.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.