WorktreeCreate no-op hook causes silent hang on `claude -w` startup

Resolved 💬 4 comments Opened Feb 23, 2026 by grancalavera Closed Mar 23, 2026

Summary

Registering a WorktreeCreate hook that does nothing (exit 0, no output) causes claude -w to hang indefinitely at startup. The hook executes successfully but Claude Code never continues past it.

This is distinct from #27467, which covers stdout pollution from git worktree add. Here the hook produces no output at all — suggesting WorktreeCreate cannot be used as a pure observer hook.

Minimal repro

https://github.com/grancalavera/worktree-create-bug-repro

git clone git@github.com:grancalavera/worktree-create-bug-repro.git
cd worktree-create-bug-repro
claude --debug-file ./debug.log -w

The repo contains:

  • .claude/hooks/noop.sh — a no-op script (exit 0)
  • .claude/settings.json — registers noop.sh for WorktreeCreate

Expected behavior

Claude Code starts normally in worktree mode.

Actual behavior

Claude Code hangs after displaying ? for shortcuts. Ctrl-C required to exit.

Debug log shows:

WorktreeCreate [.../noop.sh] completed with status 0
Hook output does not start with {, treating as plain text

Notes

  • Removing WorktreeCreate from settings.json fixes the hang immediately
  • Tested with no stdout, stderr-only output, and JSON output — all hang
  • A non-executable script (exit 126) also causes the same hang
  • VSCode intellisense does not recognize WorktreeCreate in the settings schema

Environment

  • macOS Darwin 24.6.0
  • Claude Code v2.1.50

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗