Bug: Persistent Worktree creation failure leaves an undeletable loading project

Open 💬 2 comments Opened Jun 28, 2026 by luckly2888-hash
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What issue are you seeing?

Summary

Creating a Persistent Worktree fails and leaves behind a permanently loading Project that cannot be removed from the sidebar.

Even after the worktree creation fails, the partially created Project remains visible with a spinning/loading indicator and provides no context menu or delete option.

Restarting ChatGPT Desktop does not resolve the problem.

---

Environment

  • Codex Variant: ChatGPT Desktop App
  • Platform: macOS
  • Workspace: ChatGPT Business
  • Feature: Projects + Persistent Worktree

---

Steps to Reproduce

  1. Create a new Project.
  2. Open the Project.
  3. Select Create Persistent Worktree.
  4. Wait for the worktree creation process.

The operation fails with:

Starting worktree creation

fatal: invalid reference: HEAD

git worktree add failed: fatal: invalid reference: [HEAD[](url)]([url]([url]([url](

<img width="298" height="75" alt="Image" src="https://github.com/user-attachments/assets/221c8290-8c74-4f88-9ec4-c5f4c89c4da1" />

<img width="299" height="71" alt="Image" src="https://github.com/user-attachments/assets/3b1d010e-52ff-46cc-86dd-fd25d3dd298d" />

<img width="299" height="71" alt="Image" src="https://github.com/user-attachments/assets/49e942fd-e04f-4835-863c-b8abf51fde7e" />
[

<img width="299" height="71" alt="Image" src="https://github.com/user-attachments/assets/d86a222f-442c-4a49-a8dd-ec151366833c" />

](url)
))))

### What steps can reproduce the bug?

### Steps to Reproduce

1. Open ChatGPT Desktop App (macOS).
2. Open or create a Codex Project.
3. Click **Create Persistent Worktree**.
4. Wait for the worktree creation process.

The operation fails with the following error:

```text
Starting worktree creation

fatal: invalid reference: HEAD

git worktree add failed: fatal: invalid reference: HEAD

After the failure:

  • A new Project remains in the sidebar.
  • The Project shows a permanent loading/spinning indicator.
  • There is no context menu.
  • There is no Remove/Delete option.
  • Restarting ChatGPT Desktop does not resolve the issue.
  • Waiting does not resolve the issue.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #29438

Powered by Codex Action

iamhectorlopez · 5 days ago

I can reproduce this on three unrelated macOS repositories.

Codex Desktop: 26.818.41509 (build 6962)

Every persistent-worktree attempt fails during Preparing workspace with:

fatal: invalid reference: refs/heads/HEAD

The desktop log shows Codex executing a command shaped like:

git worktree add --detach <worktree-path> refs/heads/HEAD

At least one affected repository was verified clean, with HEAD correctly pointing symbolically to refs/heads/main. There is no refs/heads/HEAD ref, and no incomplete Git worktree registration remains afterward.

Retrying repeats the same malformed command. This appears to treat Git's special HEAD reference as a local branch name by incorrectly prefixing it with refs/heads/.

The affected repositories have unrelated histories, so this does not appear to be repository-specific.