claude-code - 💡(How to fix) Fix [Bug] EnterWorktree/ExitWorktree tools don't restore core.bare config on exit

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jeffdutton/.local/share/claude/versions/2.1.139 (expected in multi-process scenarios)\n at z16 (/$bunfs/root/src/entrypoints/cli.js:2662:2257)\n at tRH (/$bunfs/root/src/entrypoints/cli.js:2662:1337)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.241Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.277Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n at async L (/$bunfs/root/src/entrypoints/cli.js:6416:11729)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.876Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n at async N (/$bunfs/root/src/entrypoints/cli.js:6416:12615)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.877Z"},{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:42:07.685Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:121:13313)\n at emit (node:events:92:22)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:3321)\n at request (/$bunfs/root/src/entrypoints/cli.js:123:2467)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:36:52.398Z"},{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:44:08.517Z"},{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:46:59.541Z"}]

Root Cause

History: this repo was originally a normal checkout (loose CLAUDE.md from Apr 14, package.json from May 11 09:21 — both still on disk). Every time EnterWorktree ran, the parent flipped to bare. ExitWorktree(remove) doesn't reset it, presumably because other worktrees (avonos-final, platform-client-dataverse-extraction) exist and worktrees work fine against a bare parent.

Code Example

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jeffdutton/.local/share/claude/versions/2.1.139 (expected in multi-process scenarios)\n    at z16 (/$bunfs/root/src/entrypoints/cli.js:2662:2257)\n    at tRH (/$bunfs/root/src/entrypoints/cli.js:2662:1337)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.241Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.277Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n    at async L (/$bunfs/root/src/entrypoints/cli.js:6416:11729)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.876Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n    at async N (/$bunfs/root/src/entrypoints/cli.js:6416:12615)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.877Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:42:07.685Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:121:13313)\n    at emit (node:events:92:22)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:3321)\n    at request (/$bunfs/root/src/entrypoints/cli.js:123:2467)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:36:52.398Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:44:08.517Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:46:59.541Z"}]
RAW_BUFFERClick to expand / collapse

I have seen this issue for months, but today Claude Code was able to determine why. This has contributed to my hatred of work trees, but I see how they are useful, however Claude Code usage of them must be reliable.

Bug Description Found the culprit. .git/config mtime is May 12 08:47:14 — minutes ago, right after my ExitWorktree --remove. The Claude Code harness EnterWorktree/ExitWorktree tools flip core.bare = true when you enter a worktree, and don't restore it on exit. That's not documented in the tool descriptions, but the config mtime nails it.

History: this repo was originally a normal checkout (loose CLAUDE.md from Apr 14, package.json from May 11 09:21 — both still on disk). Every time EnterWorktree ran, the parent flipped to bare. ExitWorktree(remove) doesn't reset it, presumably because other worktrees (avonos-final, platform-client-dataverse-extraction) exist and worktrees work fine against a bare parent.

The existing files at the root are leftover from before any of those EnterWorktree calls ever happened. They're not tracked while bare = true.

One-line fix (gives you back a normal working tree at this directory; doesn't affect the other worktrees — they work fine either way):

git config --local core.bare false

Want me to run that? After it, git status will work here and the loose files will be visible relative to main.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.139
  • Feedback ID: 4ff26c9c-b9c6-4182-8bb9-c6dd03947a0b

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jeffdutton/.local/share/claude/versions/2.1.139 (expected in multi-process scenarios)\n    at z16 (/$bunfs/root/src/entrypoints/cli.js:2662:2257)\n    at tRH (/$bunfs/root/src/entrypoints/cli.js:2662:1337)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.241Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.277Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n    at async L (/$bunfs/root/src/entrypoints/cli.js:6416:11729)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.876Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at m7H (/$bunfs/root/src/entrypoints/cli.js:2663:36777)\n    at async N (/$bunfs/root/src/entrypoints/cli.js:6416:12615)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:36:58.877Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-11T23:42:07.685Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:121:13313)\n    at emit (node:events:92:22)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:3321)\n    at request (/$bunfs/root/src/entrypoints/cli.js:123:2467)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:36:52.398Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:44:08.517Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:6192)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-12T12:46:59.541Z"}]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING