cli: --worktree silently hangs when name contains a slash

Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 5 comments · opened Mar 24, 2026 · closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Bug description

claude --worktree <name> silently hangs (no output, no error) when the worktree name contains a / character (e.g., improve/methodology). The process never renders the TUI and must be killed manually.

Reproduction steps

# This works fine:
claude --worktree test-no-slash

# This hangs indefinitely (no output at all):
claude --worktree improve/methodology

# Also hangs with --agent-name:
claude --agent-name cto --worktree improve/methodology

Expected behavior

Either:

  1. Create nested worktree directory (.claude/worktrees/improve/methodology/) using mkdir -p and proceed normally, or
  2. Reject the name with a clear error message (e.g., "worktree name must not contain '/'")

Actual behavior

The process hangs silently — no TUI rendered, no error output, no exit. Must be killed with Ctrl+C or kill.

Investigation details

Tested systematically with script to capture TTY output:

| Command | Result |
|---------|--------|
| claude -w test-no-slash | ✅ Normal — TUI appears in ~2s |
| claude -w improve/methodology | ❌ Hangs — 45s+ no output |
| claude --agent-name cto -w test-no-slash | ✅ Normal |
| claude --agent-name cto -w improve/methodology | ❌ Hangs |

  • git worktree add itself handles nested paths fine (manually tested with git worktree add .claude/worktrees/improve/test -b worktree-improve/test — succeeds instantly)
  • After the hang, a residual empty .claude/worktrees/improve/ directory is left behind, suggesting the parent directory creation partially succeeds but the worktree setup fails silently

Workaround

Use - or _ instead of / in worktree names:

claude -w improve-methodology   # works

Environment

  • Claude Code: v2.1.81
  • OS: Ubuntu (Linux 6.17.0-19-generic)
  • Git: 2.47.2
  • Shell: tcsh / bash

View original on GitHub ↗

5 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/36894
  2. https://github.com/anthropics/claude-code/issues/37874
  3. https://github.com/anthropics/claude-code/issues/37965

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

benjaaguila · 5 months ago

Same issue here!!!!

benjaaguila · 5 months ago
ashwin-ant collaborator · 4 months ago

This was fixed in v2.1.83--worktree with a name containing / now creates the worktree and exits with a clear error on failure instead of hanging silently. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.