codex - 💡(How to fix) Fix Error: turn/start: turn/start failed: Input exceeds the maximum length of 1048576 characters. [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#20742Fetched 2026-05-03 04:46:23
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

Error: turn/start: turn/start failed: Input exceeds the maximum length of 1048576 characters.

Code Example

Error: turn/start: turn/start failed: Input exceeds the maximum length of 1048576 characters.
RAW_BUFFERClick to expand / collapse

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

  1. Send a single user turn containing more than 1,048,576 characters.
  2. Observe the turn/start failed error, even when the input is well within the model's token budget.

extent analysis

TL;DR

Increase the character limit for user turns to align with the model's actual context window of approximately 922k input tokens.

Guidance

  • Verify the current character limit by checking the error message and the input length that triggers it.
  • Consider adjusting the character limit to a value that corresponds to the model's token budget, taking into account the average token length.
  • Test the updated limit with inputs of varying lengths to ensure it accurately reflects the model's capabilities.
  • Review the model's documentation to confirm its context window and token budget.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a configuration or parameter adjustment.

Notes

The exact character limit adjustment may depend on the specific requirements and constraints of the application, as well as the characteristics of the input data.

Recommendation

Apply a workaround by increasing the character limit to a value that aligns with the model's context window, as this will allow the model to utilize its full capabilities without arbitrary restrictions.

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