GPT-4.1 failing to use `apply_patch`

Resolved 💬 16 comments Opened Apr 23, 2025 by fouad-openai Closed May 15, 2025
💡 Likely answer: A maintainer (fouad-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.1.2504221401

Which model were you using?

gpt-4.1

What platform is your computer?

darwin 24.3.0 arm64 arm

What steps can reproduce the bug?

Using gpt-4.1 as model, it doesn't call apply_patch - it just writes the patch in the assistant message.

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

16 Comments

Yamilquery · 1 year ago

Yes, the same here:

w0 [Error]: 400 No tool output found for function call call_awtGvM1Tkz1MfAeh36lau4ou.
    at e.generate (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:473:4010)
    at Rr.makeStatusError (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:477:7623)
    at Rr.makeRequest (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:477:8555)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fE.run (file:///Users/yam/.npm-global/lib/node_modules/@openai/codex/dist/cli.js:493:198) {
  status: 400,
  headers: {
    'alt-svc': 'h3=":443"; ma=86400',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '934fb18beabc4791-DFW',
    connection: 'keep-alive',
    'content-length': '184',
    'content-type': 'application/json',
    date: 'Wed, 23 Apr 2025 19:16:08 GMT',
    'openai-organization': 'user-blabla',
    'openai-processing-ms': '278',
    'openai-version': '2020-10-01',
    server: 'cloudflare',
    'set-cookie': '__cf_bm=blabla.sXjSIo-1745435768-1.0.1.1-oQEyLVda26eieznfD7TLm8KHmNsBnTVg4gn50I00PfytPAs42UpC4WffVfYj8G0Usgl67fiSV7p4FVYS3ZzBrauBjLpXpU.FOfB4NAyJcVc; path=/; expires=Wed, 23-Apr-25 19:46:08 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=C07Xu2Zhid_z_DVUZH4tKlD7vKjDNcswV9Sl0QOMVvE-1745435768032-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    'x-request-id': 'req_c81bd8bcc25b72c705940d2d753d91fa'
  },
  request_id: 'req_c81bd8bcc25b72c705940d2d753d91fa',
  error: {
    message: 'No tool output found for function call call_awtGvM1Tkz1MfAeh36lau4ou.',
    type: 'invalid_request_error',
    param: 'input',
    code: null
  },
  code: null,
  param: 'input',
  type: 'invalid_request_error'
}

Node.js v20.12.2
WalkerHi11 · 1 year ago

Same issue

brad-kenstler · 1 year ago

Same issue!

brickfrog · 1 year ago

Same. Not sure if this is a duplicate of another issue already or a quirk of the LLM itself, but it seems to consistently (~80%) of the time refuse to apply patches with o4.1, might be a function of size. Noticed it starts off, e.g. patching json, etc. but then fails spectacularly once it tries to edit "real" code.

I did some tests out of curiosity, it doesn't seem to be a blanket failure (It worked once), but it is extremely weird that the failure rate is that high.

XxUnkn0wnxX · 1 year ago

same issue on mac, none of the new models apply anything.

afspies · 1 year ago

Same on macbook M2 - wasted quite a lot of credits to get empty files.

During early testing with o3 this was not an issue, but it is consistently an issue with GPT4.1 at present. E.g.

codex
I've written a detailed README to foundation_model_vqa/prompts/README.md outlining: ...

But the file is empty. Even though --full-auto is enabled, and I suggested using shell escapes etc. to try writing.

arynaq · 1 year ago

So...

I opened up this repo, and asked it to debug itself, eventually it learned that it was generating malformed patches. There is apparently a mismatch between the patch syntax expected and generated (_ vs *), the parser vs the prompt.

At least in bfe6fac463474d8a0583fc03364eb9a08bd764c7

ferrufino · 1 year ago

This makes it unusable tbh. Are we even getting credits lost back?

toastloaf · 1 year ago

Im having the same issue, effectively makes 4.1 unusable for a lot of tasks, what a shame.

liviuios · 1 year ago

same here. not writing anything on macOS with gpt 4.1

hadoopjax · 1 year ago

same issue

kohl00 · 1 year ago

how is this not fixed? GPT-4.1 is supposed to be a flagship developer model. It's unusable from my perspective.

  • gpt 4.1 and 4.1-[date-slug] are both failing
sernote · 1 year ago

same with 4.1

fouad-openai contributor · 1 year ago

this should be fixed by #930 and included in the latest release!

kohl00 · 1 year ago

thanks @fouad-openai !

ferrufino · 1 year ago

Thanks again @fouad-openai, fast delivery 🔥