--worktree hangs when name contains slashes

Resolved 💬 3 comments Opened Mar 21, 2026 by fesilvajacquier Closed Mar 21, 2026

Bug Description

claude --worktree hangs indefinitely when the worktree name contains forward slashes (e.g., fesilvajacquier/sc-18/feature-name). The same command works fine with flat names (no slashes).

Reproduction

# Works — exits normally
claude --worktree my-feature -p "say hello"

# Hangs — never starts, exits only on timeout (exit code 124)
claude --worktree my/nested/feature -p "say hello"

# Works — exits normally
claude --worktree my-nested-feature -p "say hello"

All three tests run in the same project directory, same Claude version, same environment. The only variable is slashes in the name.

Evidence

| Test | Name | Result |
|------|------|--------|
| 1 | quick-test | Exit 0 — worked |
| 2 | fesilvajacquier/sc-18/test-slash | Exit 124 — timed out |
| 3 | sc-18-validez-legal | Exit 0 — worked |

Context

  • This is a regression. Slashes in worktree names worked previously — there are existing git branches like worktree-fesilvajacquier/sc-16/planificacion-de-capacitaciones that were created successfully via --worktree in the past.
  • The project has a WorktreeCreate hook in .claude/settings.json that runs bundle install, yarn install, yarn build, and rails db:prepare. Running these steps manually in a worktree with a slashed name works fine — the hang occurs before or during Claude's own worktree initialization, not in the hook script.
  • Without --worktree, claude -p "say hello" works instantly.

Environment

  • Claude Code: v2.1.81
  • OS: Ubuntu Linux (Pop!_OS), kernel 6.17.9
  • Shell: zsh
  • Git: standard install

View original on GitHub ↗

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