Session hangs on startup when additionalDirectories contains unreachable network drive path (Windows)
Bug Description
When ~/.claude/settings.json contains an additionalDirectories entry pointing to a network drive that is not currently mounted (e.g., Z:\scripts when the NAS is offline), Claude Code hangs indefinitely during session startup, resulting in a 60-second handshake timeout.
Steps to Reproduce
- Mount a network drive (e.g.,
Z:→ NAS share) - In a Claude Code session, approve access to a path on that drive (e.g.,
Z:\scripts) - This adds
Z:\scriptstopermissions.additionalDirectoriesin~/.claude/settings.json - Disconnect from the network / unmount the drive
- Try to start a new Claude Code session → hangs indefinitely
Expected Behavior
Claude Code should either:
- Skip unreachable directories with a warning instead of hanging
- Use a timeout when scanning
additionalDirectoriespaths - Not block session startup on directory enumeration
Actual Behavior
Session startup blocks completely. No error message is shown. After 60 seconds, a handshake timeout occurs (in VS Code extension) or the CLI just hangs.
Root Cause Investigation
Through binary search on the settings.json entries, I isolated the exact blocker: a single additionalDirectories entry pointing to an unmounted network drive (Z:\scripts). Removing just that one entry immediately fixed the startup.
This is a common scenario for users who work from different locations (e.g., home with NAS vs. mobile/train without NAS).
The 803 permission rules and 13 hooks in the same settings.json were NOT the problem — all were restored successfully after removing the unreachable path.
Environment
- OS: Windows 11 Pro 10.0.26200
- Claude Code: 2.1.109 (VS Code Extension + CLI)
- Shell: Git Bash
Related Issues
- #46647 (Handshake timeout — same symptom, possibly same root cause for some users)
- #29935 (UNC paths in settings.json)
- #24140 (Symlinked .claude on network drive)
Workaround
I wrote a SessionStart hook that warns about unreachable paths at session start. However, this only warns after startup — it cannot prevent the hang since the directory scanning happens before hooks run.
The real fix needs to be in Claude Code's startup sequence: additionalDirectories scanning should have a timeout or use non-blocking I/O.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗