Codex 400 {"detail":"Bad Request"}: request compression and the fix
A bare 400 from Codex with a ChatGPT sign-in, which users trace to zstd request compression. Set enable_request_compression = false in config.toml.
A bare 400 {"detail":"Bad Request"} from Codex signed in with ChatGPT is OpenAI’s server rejecting the request body without saying why. Users who have tracked it down since November 10, 2026 find it tied to Codex’s zstd compression of request bodies, which is on by default: the same request goes through uncompressed. Add enable_request_compression = false under [features] in ~/.codex/config.toml, restart Codex; in users’ reports the chat that failed on every turn then recovers. OpenAI has not confirmed the cause; the cost is larger uploads.
What the message looks like
In the terminal, or in a codex exec run:
ERROR: {"detail":"Bad Request"}Copiedor, with the status in front, 400 {"detail":"Bad Request"}. The body is the whole answer: 24 bytes, no error code, no request id, no hint. It comes back from chatgpt.com/backend-api/codex/responses, the endpoint Codex uses when you sign in with a ChatGPT plan. In users’ reports it sticks to a conversation, often one carrying images, which then fails on every turn.
Why compression is the suspect
Codex compresses the requests it sends to OpenAI with zstd. The config reference lists it as features.enable_request_compression, “Compress streaming request bodies with zstd when supported (stable; on by default)”, and the source at 0.171.0 applies it only with a ChatGPT sign-in, only to OpenAI’s own backend, and only to requests sent over plain HTTPS rather than Codex’s WebSocket connection. Codex uses HTTPS when the WebSocket is not available, and for the rest of a session once it has fallen back to it.
The link to compression is users’ finding, not OpenAI’s. In openai/codex#60594, open since November 10 with reports from Windows, macOS and Linux across CLI and desktop builds from 0.166 to 0.169, several users say switching compression off brought failing chats back, and one saw the chat fail again when they restored the default and recover when they turned it off again. In openai/codex#61489, a user on Codex CLI 0.167.0 on Linux built a reproduction: a request carrying an image that compresses extremely well failed with the 400 three times out of three with compression on and succeeded three times out of three with it off. Their reading is that the server refuses bodies that expand far beyond their compressed size; in their tests, ratios up to about 106× passed and about 117× and above failed, though another commenter points out that the whole-body ratio is not a clean cutoff. Neither issue has a reply from OpenAI, and no release up to 0.171.0 (November 20, 2026) changes the setting’s default.
Turn request compression off
In ~/.codex/config.toml:
[features]
enable_request_compression = falseCopiedIf the file already has a [features] table, add the line to it rather than starting a second one. Then quit and restart Codex; users of the desktop app report it only took effect after a full restart. To try it on one run first, pass it as an override:
codex -c features.enable_request_compression=falseCopiedThe same key in a project’s .codex/config.toml works too, but Codex reads project config only for a project you have marked as trusted (the config basics page). To see whether compression is in play, the change that added it logs each compressed request with its size before and after when Codex runs with RUST_LOG=$RUST_LOG,codex_client::transport=info.
What it costs: every request goes up at full size. A conversation resends its history on each turn, so on a long one that is more to upload per turn, which matters most on a slow or metered link. The example in that change shrank a 28,914-byte request to 11,485 bytes. Once OpenAI fixes the server or Codex learns to retry uncompressed, deleting the line puts the default back.
When it is a different error
The compression 400 only happens with a ChatGPT sign-in. With an API key, Codex sends requests uncompressed, so a 400 there has another cause. A 400 that names the model, “not supported when using Codex with a ChatGPT account”, is the server refusing the model name, covered in model not supported with a ChatGPT account. A 401 Unauthorized is sign-in, not the request. And a reply that starts and then breaks off is stream disconnected before completion, which is the connection ending, not the request being refused. If the bare 400 persists with compression off, the cause is something else, and #60594 is where to add your version and platform.