go-git fails with extensions.worktreeconfig: repositoryformatversion does not support extension
Resolved 💬 4 comments Opened Mar 14, 2026 by rickpeters Closed Apr 12, 2026
Description
When Claude Code's isolation: "worktree" agent feature creates a git worktree, git automatically sets extensions.worktreeconfig=true in the repository config. After the worktree is cleaned up, this extension remains.
Subsequent Claude Code operations (e.g. stop hooks, turn-end lifecycle events) fail because go-git does not support the worktreeconfig extension:
WARN failed to compute file changes component=lifecycle agent=claude-code
error="failed to open repository: failed to open repository: failed to open repository:
core.repositoryformatversion does not support extension: worktreeconfig"
failed to get git author: failed to open git repository: failed to open repository:
failed to open repository: core.repositoryformatversion does not support extension: worktreeconfig
Steps to reproduce
- Use an agent with
isolation: "worktree"in a Claude Code session - After the agent completes, the worktree is cleaned up but
extensions.worktreeconfig=trueremains in.git/config - All subsequent lifecycle hooks fail with the above error
Workaround
Manually remove the extension:
git config --local --unset extensions.worktreeconfig
Expected behavior
Claude Code should either:
- Clean up
extensions.worktreeconfigwhen removing worktrees, or - Use a go-git version that supports the
worktreeconfigextension, or - Gracefully ignore unknown extensions that don't affect its operations
Environment
- Claude Code CLI (latest)
- macOS Darwin 25.4.0
- Git 2.x with
repositoryformatversion=1
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗