[BUG] Hook Configuration Progressive Duplication Causing Performance Issues
Summary
Claude Code hooks progressively duplicate during sessions,
causing multiple simultaneous executions (up to 10+ ESLint
processes) after each file edit, resulting in severe performance
degradation.
Environment
- Claude Code Version: v1.0.51
- OS: macOS (Darwin 24.5.0)
- Platform: PNPM-based Next.js 15 project
- Config Location: .claude/settings.local.json
Problem Description
- Progressive Duplication: Hooks gradually multiply over time
during active Claude Code sessions
- Performance Impact: Multiple ESLint processes run
simultaneously (observed up to 10 instances)
- Resource Consumption: High CPU/memory usage from duplicate
processes
- Workflow Disruption: Significant slowdown during file editing
operations
Steps to Reproduce
- Configure PostToolUse hooks for ESLint checking
- Use Claude Code for extended file editing session
- Observe progressive increase in hook execution time
- Check system processes during file edits - multiple ESLint
instances running
Expected Behavior
Single hook execution per configured trigger event.
Actual Behavior
Multiple identical hook executions (2x, 5x, 10x+) for single
trigger event, increasing over session duration.
Current Configuration (After Manual Cleanup)
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{
"type": "command",
"command": "python3 '/path/to/eslint_check.py'"
}
]
}
]
}
}
Workaround
Manual cleanup of configuration file and Claude Code session
restart.
Suspected Root Cause
Hook registry not properly cleared between operations, leading to
accumulation of hook configurations in memory.
6 Comments
+1 getting the same behavior. PreTool Hook is getting duplicated and eventually causes Claude Code to stop working when trying to process hooks. Can't find a clear cause of the duplication. I can watch hooks get called without a duplicate being added to the settings.local.json, but other times I look and I have 100s of the same hook.
I can confirm, I also have the same issue on version 1.0.52, got a 16k+ stop hooks at one point
I noticed the same phenomenon. I am using VSCode on Ubuntu Server via SSH from MacOS.
After looking into the settings in detail, it appears that each hook is being duplicated 64 times.
<img width="936" height="129" alt="Image" src="https://github.com/user-attachments/assets/e70e2cc2-f737-4eb8-b1c3-b97144adbcbe" />
Unfortunately, this setting is not managed by git, so it is unclear when it was duplicated. If my memory is correct,
MaxListenersExceededWarningstarted appearing on Monday of this week when using claude code.This regression was fixed in v1.0.53 in that /hooks will no longer duplicate configs. However, you will need to manually clean up your settings file due to the regression.
I am adding a fix in the next release v1.0.56 that will deduplicate the hooks commands when reading settings files that have duplicates, but you should still clean up the settings file.
The deduplication logic is now deployed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.