Codex {"detail":"Bad Request"}: What to Do by When It Started
{"detail":"Bad Request"} in Codex is an HTTP 400 it doesn't retry. Long thread: /compact or start fresh. New threads fail too: turn off request compression.
On this page

{"detail":"Bad Request"} is the entire answer the server sent back with an HTTP 400. It doesn't say what was wrong, and Codex doesn't retry it. Because every new message in a thread sends that thread's history again, typing "continue" usually gets the same line back.
What to do depends on when it started. In a long or resumed thread, run /compact once, and if that fails, open a new thread with a short written handoff. If it started right after an image was attached or opened, use a new thread without that image. If a fresh, text-only thread fails too, or you need the old thread back, turn off request compression with codex features disable enable_request_compression and restart Codex. If you use a third-party or custom provider, first run one short prompt through the official ChatGPT login.
As of November 30, 2026, OpenAI has not published a root cause. Turning request compression off is a workaround from users: it brought several stuck threads back, it has counterexamples, and it makes uploads larger. If the same thread still fails after the one step for your case, stop resending and submit /feedback from it.
{"detail":"Bad Request"} after every prompt: why "continue" fails again
Resending usually fails because Codex treats this 400 as final and your next message carries the same history that was just rejected. In a test on November 30, 2026, codex-cli 0.172.0 on a ChatGPT login was pointed at a local mock server that always returned this 400. Codex sent one request, printed ERROR: {"detail":"Bad Request"} and exited in about 3 seconds, with no Reconnecting line. Codex-cli 0.166.0 with an API-key provider behaved the same way on November 25: one request, 0.70 seconds. When that mock returned a 500 instead, Codex showed Reconnecting... 1/5 through 5/5 and made 30 requests over 26.91 seconds before giving up.
If you did see Reconnecting 5/5 before the error, that was probably a different failure in front of it. In issue #59621, an image-heavy chat unable to continue, the WebSocket connection kept dropping through five retries, Codex fell back to plain HTTP, and the HTTP request then came back as the 400.
One more attempt is reasonable; a string of them is not. A Windows user in that issue saw four requests fail within about two and a half minutes, and the chat then recovered by itself some five minutes later. Restarting the app or switching models has the same mixed record: in #61097, a conversation failing after compaction, moving from GPT-6.1 Sol to GPT-6 Astra revived one user's thread, while the original reporter had already tried other models without success.
"I can't get overnight runs done AT ALL," one user wrote on #12119, and the missing retry explains why: codex exec exits on this 400, so an unattended run stops there and can't carry on by itself. No tested fix makes it continue. In the morning, check what the run actually finished before trusting its result, and hand the remaining step to a new thread.
Which case is yours? Go by when the Bad Request started
Match the moment the error first appeared, then take the one action in that row. The word "compression" covers two unrelated things here. Context compaction, the /compact command, summarizes your conversation. Request compression, the enable_request_compression setting, shrinks the data Codex uploads with zstd and leaves the conversation alone.

| When it first appeared | Likely reason | What to do | Who reported it |
|---|---|---|---|
| In a long or resumed thread, or during context compaction | The history being resent is unusually large or contains something the server rejects | /compact once, then a new thread with a handoff | An OpenAI employee, for long sessions (#12119); users, for compaction (#60077, #61097) |
| Right after an image was attached, or a tool opened one | Image data in the history, often the same image twice | New thread without the repeated image | Users (#60739, #62451) |
| In a fresh thread with only text | A compressed request body the server rejects | Turn off request compression and restart | A Windows user, November 10, 2026, whose rebuilt request failed compressed and passed as plain JSON (#60594) |
| Only with a third-party or custom provider | That provider or proxy may have written the 400 itself | Run the same short prompt on the official login | A mock test: Codex prints whatever body the server returns |
The first row has the only first-party comment. On #12119, OpenAI's etraut-openai wrote that the error "appears to be correlated to unusually long sessions and/or user prompts," and in #10571, the main "Bad request" thread, he told one reporter that the uploaded session was over 100 MB with well over 10,000 items. That is a correlation, and users have contradicted it: one Windows user on #12119 gets the error in conversations less than a day old with no images. A context meter that still shows room doesn't rule the case out either, since one thread in #10571 failed at about 126K of 258K tokens. How to Check Codex Token Usage: /status, /usage, Context, and API Spend shows where to read that number.
For a third-party or custom provider, the point of the comparison is to find out who sent the 400. Open a new thread on the ChatGPT login with no custom model_provider, and send a one-line prompt. If that works while your provider still fails, take the request ID to the provider, because the request-compression switch may not do anything on that connection: in the November 25 test, codex-cli 0.166.0 sent its requests to an API-key custom provider uncompressed even though the setting was on. Codex Custom Provider Setup: API Key, Base URL, and Auth covers how to switch providers without mixing up credentials.
Error running remote compact task: {"detail":"Bad Request"}
This line means the compaction request was rejected, so running /compact again repeats the step that just failed. The reporter of #60077 restarted the app and still got it on every message, and in #61097 both the original conversation and its branches failed while new conversations worked. If the thread is worth saving, go in this order:
- Stop sending messages, and copy your last prompt and any output you need. Don't fork or branch the thread; forks also failed for users in #10571, #12119 and #61097.
- Turn off request compression using the steps in the next section, restart Codex fully, reopen the same thread and send one short message. Three users in #60594 continued existing desktop chats this way, two on macOS (one of them in two chats) and one on Windows. None of the three describes a remote compact error, so treat it as one try.
- If it still fails, open a new thread and write the handoff yourself: the goal, what is done, the files changed, the commands that verify it, and the next step. Don't paste the old transcript or its images. One user in #10571 who pointed a new chat at the old one got through a single prompt before the error returned.
- Send
/feedbackfrom the broken thread before you leave it.
If compaction itself hasn't failed, /compact is worth one try, but the results are split. A user running Codex in Traditional Chinese recovered a long chat by compacting manually, and had to type /精簡 because the English command did nothing in that interface. Another, in #10571, ran /compact on CLI 0.147.0 and the error continued.
Turn off enable_request_compression, and what it costs
Set enable_request_compression to false and restart Codex. It is on by default, and it applies to the HTTP requests Codex sends on a ChatGPT login. In #61489, a bare 400 on highly compressible content, the same image failed three times out of three with the setting on and passed three out of three with it off, on codex-cli 0.167.0; that user says long conversations that had been failing every turn also worked again.
-
To test it once without changing anything, start a new run with
codex -c features.enable_request_compression=false. -
To keep it off, run
codex features disable enable_request_compression. Or edit~/.codex/config.tomlyourself and add the line under the[features]table you already have:[features] enable_request_compression = false -
Quit Codex completely and open it again. The reporter of #60594 found that an app already running kept its old setting after the file was edited.
-
Run
codex features listand check that theenable_request_compressionline ends infalse. -
To undo it, run
codex features enable enable_request_compression, or delete the line.
Both commands and the hand-written line were run on November 30, 2026, with codex-cli 0.166.0 and a separate config folder. Each changed the value that codex features list reports. Don't add a second [features] heading: that version then refuses to start with a duplicate key error. For the desktop app, the evidence that it reads this setting is a user's: in the Windows chat in #60594, telemetry confirmed the setting was off after a reload, and the chat's next six requests succeeded.
The cost is upload size. On November 30, 2026, codex-cli 0.172.0 on a ChatGPT login sent the same prompt, about 140,000 repeated characters, as 40,202 bytes with request compression on and 253,735 bytes with it off, or 6.3 times larger. Two identical 830,944-byte PNGs went out as 868,056 and 2,330,168 bytes, or 2.7 times larger. That mostly matters on slow or metered connections. OpenAI's production best practices on compressing request bodies say compression doesn't change token usage or context limits, but that page documents POST /v1/responses in the API, not the chatgpt.com backend Codex uses on a ChatGPT login.

It is not a cure for every 400. The same people who found the pattern report counterexamples: some compressed requests succeeded, and a 21.6 MB input went through either way. The same API page says a body that expands to more than 100 times its compressed size gets an HTTP 413. Whether the chatgpt.com backend applies that limit is not documented there, so a bare 400 doesn't confirm it as the reason. If turning it off changes nothing, switch it back on.
Bad Request right after an image entered the thread
Open a new thread and don't bring the same image in twice. In several reports the image was attached once, then Codex opened the same file with its view_image tool. The history then held two copies, and later text-only messages failed too. #60739 describes that sequence on macOS, with two short text-only retries rejected; a Windows user on #60594 saw even a one-character follow-up fail, and another on #59621 confirmed by hash that three images in the history were byte-identical repeats.
So in the new thread, describe what the image shows, or give Codex the file once and tell it not to reopen it. For an image edit, the #62451 reporter got through by having Codex pass the file path straight to the image tool with no viewing step. Size matters too in some reports: a #60594 user's 3,690,783-byte screenshot shrank to 27,180 bytes after lossless re-encoding and then worked in a separate chat. Shrinking the file on disk won't repair a thread that already contains the large version. If that thread is the one you need, use the request-compression switch above.
Is {"detail":"Bad Request"} fixed in Codex 0.172.0?
No fix has been announced. As of November 30, 2026, none of the release notes from 0.169.1 through 0.172.0 mentions this 400. #10571, #60594 and #61489 are still open, #12119 was closed as a duplicate of #10571, and #60077 was closed as not planned. A server-side change could still have happened without appearing in those notes.
The error did not reproduce on November 30, 2026. Eleven real codex exec runs against OpenAI's endpoint, on one ChatGPT account with gpt-6.1-sol, all succeeded: eight on 0.172.0 and three on 0.166.0. Seven had request compression on and four had it off. They used the two kinds of input that failed in the #60594 reports, a long run of repeated text and two identical synthetic PNGs, plus one short prompt. That doesn't show it is fixed. These were fresh, single-turn sessions on one Mac over HTTP, so they say nothing about long threads, the desktop app, Windows or the fallback from WebSocket. Update if you are behind, but don't count on the update as the fix: a user in #10571 went from 0.146.0 to 0.147.0 and the thread kept failing.
When to stop and send /feedback
Stop when the one action for your case has failed and a single short message in the same thread still returns {"detail":"Bad Request"}. Run /feedback in the broken thread so the session logs are attached; in the desktop app, the reporter of #60077, a conversation blocked by remote compaction, used Help > Send Feedback. Then post the thread ID on #10571, which is what etraut-openai asked people there to do, along with your Codex version, operating system, when the error started, and whether turning request compression off changed anything.
Keep the local history while you wait. One #10571 user reported that deleting ~/.codex helped, and another removed 574 embedded images from a 985 MB session file and revived the thread. Neither is an OpenAI procedure, and by default that folder holds your saved sessions and your configuration. If you experiment at all, do it on a copy.
"unexpected status 400", 429 and "at capacity" are different errors
A line that starts with unexpected status 400 Bad Request is a different line, reported mostly on older Codex versions in 2025 GitHub issues, so go by the text printed after it. {"error":{"message":"Bad Request",...},"status":400} is a different response: in #63960, bursts of 400 across every running thread, it hit all threads within a minute, a new message usually worked, and a November 29 comment there traces it to how T3 Code supplies its login token.
For a 429, go to Codex Exceeded Retry Limit, Last Status: 429 Too Many Requests. If the message says the model is at capacity, see Codex “Selected Model Is at Capacity”: Not Your Limit, What to Do. If the app shows "Error submitting message" with a second line under it, see Codex “Error Submitting Message”: Fix It by the Second Line.
Sources11
External pages this guide links to, in the order they appear. Last updated Nov 30, 2026.
Sources11
External pages this guide links to, in the order they appear. Last updated Nov 30, 2026.
- 1.issue #59621, an image-heavy chat unable to continuegithub.com/openai/codex/issues/59621
- 2.#61097, a conversation failing after compactiongithub.com/openai/codex/issues/61097
- 3.#12119github.com/openai/codex/issues/12119
- 4.#60077github.com/openai/codex/issues/60077
- 5.#60739github.com/openai/codex/issues/60739
- 6.#62451github.com/openai/codex/issues/62451
- 7.#60594github.com/openai/codex/issues/60594
- 8.#10571, the main "Bad request" threadgithub.com/openai/codex/issues/10571
- 9.#61489, a bare 400 on highly compressible contentgithub.com/openai/codex/issues/61489
- 10.OpenAI's production best practices on compressing request bodiesdevelopers.openai.com/api/docs/guides/production-best-practices
- 11.#63960, bursts of 400 across every running threadgithub.com/openai/codex/issues/63960





