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

  1. Use an agent with isolation: "worktree" in a Claude Code session
  2. After the agent completes, the worktree is cleaned up but extensions.worktreeconfig=true remains in .git/config
  3. 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.worktreeconfig when removing worktrees, or
  • Use a go-git version that supports the worktreeconfig extension, 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

View original on GitHub ↗

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