codex - 💡(How to fix) Fix Windows desktop: Discard changes fails with "patch with only garbage" for thread diff

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…

In the Codex Windows desktop app, clicking Discard/Revert changes for a local thread fails every time with:

Git application error: error: patch with only garbage at line 4

Error Message

Git application error: error: patch with only garbage at line 4

Root Cause

In the Codex Windows desktop app, clicking Discard/Revert changes for a local thread fails every time with:

Git application error: error: patch with only garbage at line 4

Fix Action

Fix / Workaround

Git application error: error: patch with only garbage at line 4
  1. Work in a local repository in a Codex desktop thread.
  2. The repository has a merge commit in its recent history and the thread has reviewable changes.
  3. Click the Codex UI action to discard/revert the thread changes.
  4. A dialog reports error: patch with only garbage at line 4 and no changes are reverted.

The desktop log records the failing operation as a reverse apply of a generated thread-diff patch (paths redacted):

Code Example

Git application error: error: patch with only garbage at line 4

---

[git] git.command.complete command="git -c core.hooksPath=NUL -c core.fsmonitor=false apply -R --3way '<TEMP>\codex-apply-...\patch.diff'" exitCode=128 failureReason=command_failed requestKind=apply-patch source=thread_diff stderrBytes=41
RAW_BUFFERClick to expand / collapse

Summary

In the Codex Windows desktop app, clicking Discard/Revert changes for a local thread fails every time with:

Git application error: error: patch with only garbage at line 4

Environment

  • Codex desktop app: 26.519.3891.0 (Microsoft Store package)
  • Bundled Codex CLI: 0.133.0-alpha.1
  • OS: Windows 11, x64 (10.0.26200)
  • Git: 2.51.0.windows.2

Reproduction

  1. Work in a local repository in a Codex desktop thread.
  2. The repository has a merge commit in its recent history and the thread has reviewable changes.
  3. Click the Codex UI action to discard/revert the thread changes.
  4. A dialog reports error: patch with only garbage at line 4 and no changes are reverted.

Desktop log evidence

The desktop log records the failing operation as a reverse apply of a generated thread-diff patch (paths redacted):

[git] git.command.complete command="git -c core.hooksPath=NUL -c core.fsmonitor=false apply -R --3way '<TEMP>\codex-apply-...\patch.diff'" exitCode=128 failureReason=command_failed requestKind=apply-patch source=thread_diff stderrBytes=41

Diagnosis performed

  • The repository itself is valid and Git operations work normally.
  • Running an equivalent reverse git apply --check -R --3way against a regular unified diff generated by Git succeeds.
  • The failure only occurs through the Codex desktop discard/revert action using its generated thread_diff patch.
  • The working tree contains CRLF files and a small number of mixed-EOL files, but a Git-generated patch still parses and reverse-applies correctly.

This suggests the desktop app is emitting a malformed patch for thread_diff on Windows, possibly in combination with merge history and/or line-ending normalization.

Expected behavior

Discarding thread changes should reverse-apply the displayed diff or provide a recoverable conflict result, rather than producing an invalid patch parse error.

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

Discarding thread changes should reverse-apply the displayed diff or provide a recoverable conflict result, rather than producing an invalid patch parse error.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING