codex - 💡(How to fix) Fix Codex VS Code extension logs Git metadata failures in unborn Git repositories [2 comments, 2 participants]

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…
GitHub stats
openai/codex#19326Fetched 2026-04-25 06:11:40
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2cross-referenced ×1

The Codex VS Code extension logs Git metadata failures when the workspace is a Git repository that has been initialized but has no commits yet (an "unborn branch" state).

The failure disappeared after creating the first commit with:

git commit --allow-empty -m "Initialize repo"

Root Cause

The Codex VS Code extension logs Git metadata failures when the workspace is a Git repository that has been initialized but has no commits yet (an "unborn branch" state).

The failure disappeared after creating the first commit with:

git commit --allow-empty -m "Initialize repo"

Fix Action

Fix / Workaround

Workaround confirmed

Code Example

git commit --allow-empty -m "Initialize repo"

---

mkdir C:\Users\<user>\codex-test\codex-unborn-git-repro
   git -C C:\Users\<user>\codex-test\codex-unborn-git-repro init

---

git -C C:\Users\<user>\codex-test\codex-unborn-git-repro status --short --branch
   git -C C:\Users\<user>\codex-test\codex-unborn-git-repro rev-parse --abbrev-ref HEAD
   git -C C:\Users\<user>\codex-test\codex-unborn-git-repro rev-parse HEAD

---

## No commits yet on master
   HEAD
   revparse_abbrev_exit=128
   HEAD
   revparse_head_exit=128
   fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

---

'C:\Program Files\Git\cmd\git.exe' rev-parse --abbrev-ref HEAD

---

[git] git.command.complete ... command="'C:\\Program Files\\Git\\cmd\\git.exe' rev-parse --abbrev-ref HEAD" ... cwd=C:/Users/<user>/codex-test ... exitCode=128 failureReason=command_failed ... subcommand=rev-parse

---

2026-04-24 10:24:39.422 exitCode=128 subcommand=rev-parse
2026-04-24 10:26:42.768 exitCode=128 subcommand=rev-parse
2026-04-24 10:33:09.063 exitCode=128 subcommand=rev-parse

---

git commit --allow-empty -m "Initialize repo"

---

git rev-parse --abbrev-ref HEAD => master, exit 0
git rev-parse HEAD => <commit sha>, exit 0

---

[IpcClient] Received broadcast but no handler is configured method=thread-stream-state-changed
RAW_BUFFERClick to expand / collapse

Summary

The Codex VS Code extension logs Git metadata failures when the workspace is a Git repository that has been initialized but has no commits yet (an "unborn branch" state).

The failure disappeared after creating the first commit with:

git commit --allow-empty -m "Initialize repo"

Environment

  • OS: Microsoft Windows 10 Enterprise 10.0.19045, 64-bit
  • VS Code: 1.117.0
  • Codex extension: openai.chatgpt version 26.422.21459
  • Git: git version 2.47.0.windows.2
  • Workspace: C:\Users\<user>\codex-test

Reproduction steps

  1. Create a new folder and initialize Git without making a commit:

    mkdir C:\Users\<user>\codex-test\codex-unborn-git-repro
    git -C C:\Users\<user>\codex-test\codex-unborn-git-repro init
  2. Confirm the repo is in unborn-branch state:

    git -C C:\Users\<user>\codex-test\codex-unborn-git-repro status --short --branch
    git -C C:\Users\<user>\codex-test\codex-unborn-git-repro rev-parse --abbrev-ref HEAD
    git -C C:\Users\<user>\codex-test\codex-unborn-git-repro rev-parse HEAD

    Observed:

    ## No commits yet on master
    HEAD
    revparse_abbrev_exit=128
    HEAD
    revparse_head_exit=128
    fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
  3. Open the folder in VS Code and activate the Codex extension.

Actual behavior

The Codex extension attempts to read Git metadata with:

'C:\Program Files\Git\cmd\git.exe' rev-parse --abbrev-ref HEAD

In an unborn repo, this command exits with code 128. Codex logs this as a warning:

[git] git.command.complete ... command="'C:\\Program Files\\Git\\cmd\\git.exe' rev-parse --abbrev-ref HEAD" ... cwd=C:/Users/<user>/codex-test ... exitCode=128 failureReason=command_failed ... subcommand=rev-parse

The same warning appeared repeatedly before the first commit:

2026-04-24 10:24:39.422 exitCode=128 subcommand=rev-parse
2026-04-24 10:26:42.768 exitCode=128 subcommand=rev-parse
2026-04-24 10:33:09.063 exitCode=128 subcommand=rev-parse

The log also contained repeated thread-stream-state-changed warnings during this period, although those may be a separate noisy-logging issue.

Expected behavior

Codex should treat an unborn Git branch as a valid Git repository state and avoid warning/spam loops. It should either:

  • use a Git command that supports unborn branches, such as git status --porcelain=v2 --branch, or
  • handle rev-parse HEAD / rev-parse --abbrev-ref HEAD exit code 128 as non-fatal when git status reports # branch.oid (initial).

Workaround confirmed

Creating the first commit resolves the Git metadata failure:

git commit --allow-empty -m "Initialize repo"

After that:

git rev-parse --abbrev-ref HEAD => master, exit 0
git rev-parse HEAD => <commit sha>, exit 0

Codex no longer logged the rev-parse exit 128 failure in the same workspace.

Notes

Separate noise was also observed from plugin/network fetches returning 403 or "Server overloaded", and from repeated:

[IpcClient] Received broadcast but no handler is configured method=thread-stream-state-changed

Those may be independent issues. The Git metadata issue above is the narrow, reproducible part.

extent analysis

TL;DR

The Codex extension can be fixed by handling the rev-parse exit code 128 as non-fatal when the Git repository is in an unborn branch state.

Guidance

  • Modify the Codex extension to use a Git command that supports unborn branches, such as git status --porcelain=v2 --branch, to retrieve Git metadata.
  • Handle the rev-parse HEAD / rev-parse --abbrev-ref HEAD exit code 128 as non-fatal when git status reports # branch.oid (initial), indicating an unborn branch.
  • As a temporary workaround, create an initial commit in the Git repository using git commit --allow-empty -m "Initialize repo" to resolve the Git metadata failure.
  • Verify the fix by checking the Codex extension logs for the absence of rev-parse exit 128 failures after the modification.

Example

No code snippet is provided as the issue is related to the Codex extension's behavior and not a specific code snippet.

Notes

The issue may be specific to the Codex extension's interaction with Git repositories in an unborn branch state. The provided workaround and suggested modifications should resolve the Git metadata failure, but may not address other separate issues mentioned in the logs.

Recommendation

Apply the workaround by creating an initial commit in the Git repository using git commit --allow-empty -m "Initialize repo", as this has been confirmed to resolve the Git metadata failure. A more permanent fix would involve modifying the Codex extension to handle unborn branches correctly.

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…

FAQ

Expected behavior

Codex should treat an unborn Git branch as a valid Git repository state and avoid warning/spam loops. It should either:

  • use a Git command that supports unborn branches, such as git status --porcelain=v2 --branch, or
  • handle rev-parse HEAD / rev-parse --abbrev-ref HEAD exit code 128 as non-fatal when git status reports # branch.oid (initial).

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex VS Code extension logs Git metadata failures in unborn Git repositories [2 comments, 2 participants]