[BUG] subagent with hook WorktreeCreate, error "cannot be confirmed as a separate isolation worktree"

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 1 comment · opened Aug 8, 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?

My monorepo repository is spending a significant amount of time checking out the worktree when using subagent. I hope subagent exec in HEAD(not in worktree):

but got "cannot be confirmed as a separate isolation worktree"

What Should Happen?

WorktreeCreate with python3 -c 'import json, os, sys; data=json.load(sys.stdin); print(data.get(\"cwd\") or os.getcwd())'

subagent work

Error Messages/Logs

cannot be confirmed as a separate isolation worktree

Steps to Reproduce

settings:

"hooks": {
    "WorktreeCreate": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 -c 'import json, os, sys; data=json.load(sys.stdin); print(data.get(\"cwd\") or os.getcwd())'",
            "timeout": 120
          }
        ]
      }
    ],
}

use foobar-agent to create script hello.py, create file ,content 'hello world'

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.220

Claude Code Version

2.1.225

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗