[BUG] ExitWorktree fails for worktrees created via Desktop app worktree mode

Resolved 💬 3 comments Opened Apr 15, 2026 by taige Closed Jul 2, 2026

Description

When starting a Claude Code Desktop session with the "worktree" option selected, a worktree is created under .claude/worktrees/<name> and the session operates inside it. However, calling ExitWorktree returns a no-op error:

No-op: there is no active EnterWorktree session to exit. This tool only operates on worktrees created by EnterWorktree in the current session.

The worktree was created in the current session, but through the Desktop app's UI flow rather than the EnterWorktree tool. The ExitWorktree tool does not recognize it.

Steps to Reproduce

  1. Open Claude Code Desktop
  2. Start a new conversation, select "worktree" mode
  3. Session starts in .claude/worktrees/<random-name>/ (confirmed working)
  4. Ask Claude to exit the worktree (or call ExitWorktree directly)
  5. Tool returns no-op error — cannot exit

Expected Behavior

ExitWorktree should recognize worktrees created by the Desktop app's worktree mode, not only those created by the EnterWorktree tool call.

Workaround

Manual cleanup:

cd /path/to/repo
git worktree remove .claude/worktrees/<name>

Environment

  • Claude Code Desktop (macOS)
  • Model: claude-opus-4-6

View original on GitHub ↗

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