[BUG] : Windows: CLI soft‑bricked after adding daily “auto‑fetch” hook; can't reinstall
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?
Summary
After I added a hook meant to run once per day to automatically git fetch when entering a repo, Claude Code started to freeze on every launch. The only UI I consistently see is the “Quick safety check / Is this folder trusted?” prompt; pressing 1/confirm often does nothing, and even when it does, the session never fully starts. From this state I cannot reinstall cleanly: the PowerShell one‑liner installer only prints “Setting up Claude Code…” and then stalls indefinitely without any diagnostics.
Key problems:
A misbehaving hook can apparently soft‑brick the CLI startup path (no safe‑mode fallback, no timeout/fail‑open by default). Hooks are part of settings.json and tied to events such as SessionStart / tool events. [sns.style]
The workspace trust prompt sometimes captures input unreliably (or appears again despite prior trust), leaving the TUI stuck.
The installer has no default verbosity and doesn’t report which step it’s on. When it hangs, there is no clue whether it’s network, PATH, or post‑install tasks.
The only repeated messages I can get in verbose CLI logs are benign‑looking ENOENT on missing settings (expected on a clean machine) and repeated EEXIST on mkdir %USERPROFILE% during “save config with lock”—but nothing actionable that explains the stall.
What I tried
Full cleanup of user state and config:
Delete %USERPROFILE%\.claude\ and %USERPROFILE%\.claude.json (user‑scope config/state locations). [[github.com]](https://github.com/anthropics/claude-code/issues/9113)
Reinstall via:
irm https://claude.ai/install.ps1 | iex
None of these led to a usable session.
Environment
OS: Windows (native).
Shells: PowerShell, Git Bash (MINGW64).
Terminal(s): Windows Terminal / PowerShell (and Git Bash).
Install method(s) tried:
irm | iex hangs on Setting up Claude Code… (no further output).
Installer does download a binary (see artifacts below), but CLI isn’t usable afterwards.
Also tried full “nuke & pave” (remove %USERPROFILE%\.claude and %USERPROFILE%\.claude.json, PATH cleanup) and re‑run installer; same result.
CLI version: unknown (post‑install binary name suggests 2.1.69), not reachable via claude --version due to startup stall.
Workspace state:
User‑level config directory: %USERPROFILE%\.claude\… (Windows default for Claude settings/state). [github.com]
No managed policies present at C:\ProgramData\ClaudeCode\managed-settings.json (checked; file not found). (Managed paths are part of the documented precedence model.) [claudelog.com]
Steps to reproduce
In a Windows repo, add a hook to run at first session access per day (e.g. on SessionStart) that runs git fetch --all -p. Hooks are configured in settings.json per docs. [sns.style]
Start Claude Code in that repo the next day.
From now on, any launch of Claude Code (even in other folders) stalls, showing only trust prompts or no UI progress.
Attempt a “clean install” with irm … | iex → installer prints only Setting up Claude Code… and hangs silently.
Expected behavior
A failing hook should not brick startup; the CLI should:
enforce a hard timeout and fail‑open for hook commands,
offer a documented safe mode (--no-hooks / --skip-config) that always wins precedence and guarantees a clean REPL.
The workspace trust prompt should reliably accept input and persist trust for the exact path (especially on Windows where backslashes/escaping can differ).
The installer should:
emit progress/phase messages by default (download → extract → place binary → PATH checks → post‑install),
provide clear error/timeout diagnostics (e.g., network/proxy, write permissions, PATH).
Actual behavior
CLI freezes at startup; only occasional trust prompt appears.
Installer prints only:
Setting up Claude Code...
and never completes. No progress bars or steps are printed.
Sanitized logs / artifacts
Redaction: replaced my home directory with %USERPROFILE%; removed PII; kept timestamps and messages.
From CLI verbose log:
2026-03-05T10:06:38.685Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T10:06:38.686Z [DEBUG] MDM settings load completed in 20ms
2026-03-05T10:06:38.687Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: %USERPROFILE%\.claude\settings.json
2026-03-05T10:06:38.688Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: %USERPROFILE%\.claude\settings.local.json
2026-03-05T10:06:38.688Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\ProgramData\ClaudeCode\managed-settings.json
2026-03-05T10:06:38.691Z [ERROR] Failed to save config with lock: Error: EEXIST: file already exists, mkdir '%USERPROFILE%'
2026-03-05T10:06:38.693Z [DEBUG] Git remote URL: null
2026-03-05T10:06:38.693Z [DEBUG] No git remote URL found
Note: paths like %USERPROFILE%\.claude\… are the documented user‑scope settings/state locations on Windows. Managed settings path C:\ProgramData\ClaudeCode\managed-settings.json is also documented; on my system that file does not exist. [github.com], [[claudelog.com]](https://claudelog.com/faqs/where-are-claude-code-global-settings/)
Installer view (PowerShell):
irm -Verbose https://claude.ai/install.ps1 | iex
VERBOSE: GET with 0-byte payload
VERBOSE: received 2588-byte response of content type application/octet-stream
Setting up Claude Code...
(no further output; hangs)
User data folder (Git Bash):
~/.claude
└── debug
├── 60fbdd5b-1793-43eb-a36f-c30f1519d9f8.txt
└── latest -> ~/.claude/debug/60fbdd5b-1793-43eb-a36f-c30f1519d9f8.txt
~/.claude/downloads
└── claude-2.1.69-win32-x64.exe (size ~246 MB)
(Shows that the installer did fetch an artifact, but the CLI remains unusable and claude --version cannot be run due to startup stall.)
What would help
A safe‑mode startup switch documented and honored on all platforms (e.g., --no-hooks / --skip-config) so a bad hook can’t brick the REPL.
Hard timeouts (and fail‑open) for hook execution during bootstrap.
Make EEXIST: mkdir '%USERPROFILE%' non‑fatal and demoted to info; or stop attempting mkdir on existing root path.
Workspace trust on Windows:
ensure persisted exact‑path matching (backslashes/escaping), or document the requirement clearly in the settings/state file.
Installer:
default progress output (download/extract/place/PATH), plus -Verbose/-WhatIf support, and a --diagnostics mode that prints phase timings and network target URLs (so users can detect when it’s a proxy/CA thing vs. internal step),
exit codes and detailed error messages instead of a silent stall.
Thanks!
What Should Happen?
Expected behavior
A failing hook should not brick startup; the CLI should:
enforce a hard timeout and fail‑open for hook commands,
offer a documented safe mode (--no-hooks / --skip-config) that always wins precedence and guarantees a clean REPL.
The workspace trust prompt should reliably accept input and persist trust for the exact path (especially on Windows where backslashes/escaping can differ).
The installer should:
emit progress/phase messages by default (download → extract → place binary → PATH checks → post‑install),
provide clear error/timeout diagnostics (e.g., network/proxy, write permissions, PATH).
Error Messages/Logs
Steps to Reproduce
In a Windows repo, add a hook to run at first session access per day (e.g. on SessionStart) that runs git fetch --all -p. Hooks are configured in settings.json per docs. [sns.style]
Start Claude Code in that repo the next day.
Observe that startup shows a workspace trust prompt. Confirm trust.
After confirming, the session never fully initializes (no REPL, no tools).
From now on, any launch of Claude Code (even in other folders) stalls, showing only trust prompts or no UI progress.
Attempt a “clean install” with irm … | iex → installer prints only Setting up Claude Code… and hangs silently.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.69
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗