Error: turn/start: turn/start failed: Input exceeds the maximum length of 1048576 characters.
Open 💬 3 comments Opened May 2, 2026 by Gusarich
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Codex rejects user turns longer than 2^20 (1,048,576) characters with the following error:
Error: turn/start: turn/start failed: Input exceeds the maximum length of 1048576 characters.
Problem
GPT-5.4 supports up to 922k input tokens, but this character cap translates to roughly ~300k tokens — far below what the underlying model actually accepts.
Expected behavior
The per-turn input limit should reflect the model's actual context window, not an arbitrary character count that's ~3× more restrictive.
Steps to reproduce
- Send a single user turn containing more than 1,048,576 characters.
- Observe the
turn/start failederror, even when the input is well within the model's token budget.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Changing the limit from
1<<20to1<<22and using the compiled binary helps — no other issues appear and it works properly. I believe it’s purely a client side issue fixable in 1-character change.I really hope to see a resolution to this issue, because I'm now glued to manually recompiling codex once in a while with that simple 1-character patch :(
It's literally just changing this
1<<20to1<<22. I don't see how that could break anything, and I'm using the patched version for weeks with thousands of agents and it all seems to be working well.https://github.com/openai/codex/blob/26c9502121028a7b20de2636123fbbed26efedc6/codex-rs/protocol/src/user_input.rs#L9