Skip to content

Repository with submodules fails to initialize session (unexpected gitdir format) #640

@pjbgf

Description

@pjbgf

What happened?

When running a Claude session in a repository that contains Git submodules, the session fails to initialize with the following error:

● Ran 1 stop hook (ctrl+o to expand)
  ⎿  Stop hook error: Failed with non-blocking status code: 2026/03/06 12:52:26 INFO turn-end component=lifecycle agent=claude-code
  event=TurnEnd session_id=a4f4d879-7b82-472e-9e5f-290f1346089c
  session_ref=/home/coder/.claude/projects/-home-coder-git-go-git-entire/a4f4d879-7b82-472e-9e5f-290f1346089c.jsonl
  failed to save step: failed to initialize session: failed to get worktree ID: unexpected gitdir format (no worktrees): ../.git/modules/go-git

Repository Structure

The repository uses Git submodules and has a structure similar to:

/repo
    /submodule1
    /submodule2

The session is started and worked on at /repo level.

Steps to reproduce

No response

Entire CLI version

v0.4.9

OS and architecture

Tumbleweed amd64

Agent

Claude Code

Terminal

Alacritty

Logs / debug output

{"parentUuid":"ab348121-b962-4b90-8f17-8428552fb823","isSidechain":false,"userType":"external","cwd":"/home/coder/git/go-git/entire/go-git","sessionId":"a4f4d879-7b82-472e-9e5f-290f1346089c","version":"2.1.69","gitBranch":"filesystem-perf","slug":"adaptive-whistling-shell","type":"system","subtype":"stop_hook_summary","hookCount":1,"hookInfos":[{"command":"entire hooks claude-code stop","durationMs":194}],"hookErrors":["Failed with non-blocking status code: 2026/03/06 01:49:09 INFO turn-end component=lifecycle agent=claude-code event=TurnEnd session_id=a4f4d879-7b82-472e-9e5f-290f1346089c session_ref=/home/coder/.claude/projects/-home-coder-git-go-git-entire/a4f4d879-7b82-472e-9e5f-290f1346089c.jsonl\nfailed to save step: failed to initialize session: failed to get worktree ID: unexpected gitdir format (no worktrees): ../.git/modules/go-git"],"preventedContinuation":false,"stopReason":"","hasOutput":true,"level":"suggestion","timestamp":"2026-03-06T01:49:09.461Z","uuid":"b5af7a93-f458-4818-9cfe-0c17d01c8ef6","toolUseID":"43a47dfd-ae1e-47b1-8d34-ef069e8db9a3"}

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions