codex - 💡(How to fix) Fix apply_patch fails on Windows with `CreateProcessAsUserW failed: 206` for large patch payloads [1 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#17107Fetched 2026-04-09 08:02:18
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1unlabeled ×1

Error Message

execution error: Io(Custom { kind: Other, error: "windows sandbox: runner error: CreateProcessAsUserW failed: 206" })

  • windows sandbox: runner error: CreateProcessAsUserW failed: 206

Fix Action

Fix / Workaround

On Windows, apply_patch fails when the patch payload is large, for example when adding a single large HTML file with inline CSS and JS in one patch.

Instead of applying the patch, Codex returns:

Splitting the same change into multiple smaller apply_patch calls works.

RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.117.0

What subscription do you have?

Pro

Which model were you using?

No response

What platform is your computer?

x64

What terminal emulator and version are you using (if applicable)?

No response

What issue are you seeing?

On Windows, apply_patch fails when the patch payload is large, for example when adding a single large HTML file with inline CSS and JS in one patch.

Instead of applying the patch, Codex returns:

execution error: Io(Custom { kind: Other, error: "windows sandbox: runner error: CreateProcessAsUserW failed: 206" })

Splitting the same change into multiple smaller apply_patch calls works.

What steps can reproduce the bug?

  • Add a single index.html file with a large amount of inline CSS and JS.
  • The patch is roughly in the 100KB-scale range.
  • apply_patch fails before the patch is applied with:
  • windows sandbox: runner error: CreateProcessAsUserW failed: 206

What is the expected behavior?

Large patches should either:

  • work correctly on Windows

For single-file HTML/CSS/JS outputs or other generated assets, it is natural to emit one large patch. Having to manually split patches is cumbersome and seems unnecessary if the runner can avoid command-line length limits.

Additional information

No response

extent analysis

TL;DR

Splitting large patches into smaller apply_patch calls may be a viable workaround for the issue with Codex CLI on Windows.

Guidance

  • The error message CreateProcessAsUserW failed: 206 suggests a potential issue with command-line length limits on Windows, which can be mitigated by splitting large patches.
  • Verify that the patch size is indeed the cause of the issue by testing with smaller patches and observing the results.
  • Consider implementing a patch size limit or automatic splitting in your workflow to avoid this issue in the future.
  • If possible, test the same patches on a non-Windows platform to see if the issue is specific to Windows.

Example

No specific code example is provided, as the issue seems to be related to the Codex CLI and its interaction with the Windows environment.

Notes

The exact cause of the issue is not entirely clear, but it appears to be related to the size of the patch and the limitations of the Windows environment. Further investigation may be needed to determine the root cause.

Recommendation

Apply workaround: Split large patches into smaller apply_patch calls, as this has been shown to work in the provided example. This approach can help avoid the issue until a more permanent fix is available.

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