[BUG] Hooks not found after `cd` commands, crashing Claude Code.
Resolved 💬 3 comments Opened Aug 5, 2025 by victor-bluera Closed Aug 5, 2025
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: Claude Code
- Claude CLI version: 1.0.63
- Operating System: macOS 15.2
- Terminal: zsh
Bug Description
After Claude uses the cd command, it no longer finds relative paths where hooks are defined and finds itself in a deadlock, unable to cd back or run any action as the PreToolUse hook crashes with path not found.
The user is then forced to abort the current task and restart Claude.
Steps to Reproduce
- Set a relative path in PreToolUse hook
{
"hooks": {
"PreToolUse": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "python3 .claude/hooks/some-hook.py"
}
]
}
]
}
}
- Have Claude Code
cdto a different directory to run a command. - Deadlock with crashing hook preventing any further actions, including
cdback.
Expected Behavior
Claude Code always runs the hooks commands from the directory in which it was started, not the current directory as it may change.
Actual Behavior
Claude Code locks itself out of any further actions due to path not found error in PreToolUse hook. Requires Claude Code disruption and manual restart.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗