[BUG] Background full checkout fails with not-a-git-repo when worktree mode is on for a repo with submodules

Open 💬 4 comments Opened Apr 30, 2026 by antony969

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?

With "Use worktrees for sessions" enabled, opening a new session in a repo that has submodules fails before the session begins. The intro screen shows only:

Something went wrong
Try sending your message again. If it keeps happening, share feedback so we can investigate.
Background full checkout failed: not-a-git-repo

…and the typed prompt is returned to the input box.

What Should Happen?

The session should start

Error Messages/Logs

From ~/Library/Logs/Claude/main.log (Claude Code 2.1.119, macOS):

[info] Created worktree "magical-elion-938fc4" at <repo>/.claude/worktrees/magical-elion-938fc4
[info] Starting local session local_998f40d7-... in <repo>/.claude/worktrees/magical-elion-938fc4
[error] Git command failed: git -c core.longpaths=true checkout HEAD -- . :(exclude).claude
        stderr: 'fatal: not a git repository: ../../../../../../.git/worktrees/magical-elion-938fc4/modules/ThirdParty/QCustomPlot/QCustomPlot
                 fatal: could not reset submodule index'
        cwd: '<repo>/.claude/worktrees/magical-elion-938fc4'
[error] Sentry caught: {
  eventId: '696d80420d94440fbe59b9d2d7564063',
  type: 'Error',
  value: 'Background full checkout failed: not-a-git-repo'
}
[warn] [CCD] first-turn init failed after worktree creation; removing orphaned worktree
[info] Removed worktree "magical-elion-938fc4"

Steps to Reproduce

On macOS, in Claude Code 2.1.119, enable worktree mode.
Open a repo containing at least one initialized submodule (a nested submodule is not required — a single top-level submodule reproduces it).
Start a new session and submit any prompt.
Observe the "Something went wrong" message; the session never begins.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Claude Code: 2.1.119

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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