[BUG] --worktree flag panics with segfault when .claude/worktrees directory already exists

Resolved 💬 3 comments Opened Apr 20, 2026 by AjayRamolaTR Closed May 27, 2026

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?

Bug:
┌─────────────────────┬──────────────────────────────────────────────────────────────────┐
│ Field │ Value │
├─────────────────────┼──────────────────────────────────────────────────────────────────┤
│ Claude Code version │ 2.1.96 │
├─────────────────────┼──────────────────────────────────────────────────────────────────┤
│ OS │ Windows 11 Enterprise 10.0.26100 │
├─────────────────────┼──────────────────────────────────────────────────────────────────┤
│ Runtime │ Bun v1.3.11 (6f0a17c3) Windows x64 │
├─────────────────────┼──────────────────────────────────────────────────────────────────┤
│ Command run │ claude --worktree AgentsTeam │
├─────────────────────┼──────────────────────────────────────────────────────────────────┤
│ Expected │ New worktree created at .claude/worktrees/AgentsTeam │
├─────────────────────┼──────────────────────────────────────────────────────────────────┤
│ Actual │ Exception: EEXIST on .claude/worktrees mkdir, then segfault at address 0x10 │
└─────────────────────┴──────────────────────────────────────────────────────────────────┘

Description:
▎ Running claude --worktree <name> when .claude/worktrees/ directory already exists (from a prior worktree session) causes failures:
EEXIST error trying to mkdir the parent directory instead of skipping it if it exists, (2) subsequent segfault/panic in Bun at address 0x10.
Repro: create any worktree once, exit it, then run claude --worktree <new-name> from the same project.

What Should Happen?

A new worktree should get created as "AgentsTeam"

Error Messages/Logs

laude --worktree AgentsTeam
Error creating worktree: EEXIST: file already exists, mkdir 'C:\Users\X012939\OneDrive - Thomson Reuters Incorporated\Windows 10 Data\AutomationRetrievalWorkspace\AWSRetrieval\.claude\worktrees'
============================================================
Bun v1.3.11 (6f0a17c3) Windows x64 (baseline)
Windows v.win11_dt
CPU: sse42 avx avx2 avx512
Args: "C:\Users\***\AppData\Local\Microsoft\WinGet\Packages\Anthropic.ClaudeCode_Microsoft.Winget.Source_8wekyb3d8bbwe\claude.exe" "--worktree" "AgentsTeam"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) fetch jsc spawn(6) standalone_executable exited yaml_parse
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:path/posix" "node:path/win32" "node:perf_hooks" "node:process" "node:stream" "node:stream/consumers" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "node:zlib" "ws" "node:http2"

panic: Segmentation fault at address 0x10
panicked during a panic. Aborting.

Steps to Reproduce

Run the commands in below sequences.

Step 1: claude --worktree TestAnalyzer.
Step2: claude --worktree AgentsTeam.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.96

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

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