Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenAI Codex CLI error

Codex CLI: Codex ran out of room in the model's context window

Error message
Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.

Status: Fixed in releaseLast verified 3 documented fixes8 sources

What it means

The conversation plus tool output no longer fits in the model's context window. Older builds said "Start a new conversation or clear earlier history before retrying." The server-side error behind it reads "Your input exceeds the context window of this model. Please adjust your input and try again."

Causes

  • Accumulated history and large tool outputs filling the model's context window.
  • Context-related bugs that maintainers say were fixed after the October 2025 report (#4926).

How to fix it

  1. Fix 1.

    Update Codex. Maintainer etraut-openai (#4926): a number of context-related bugs were fixed and an auto compaction feature was introduced. Auto-compaction was enabled for gpt-5-codex in 0.40.0 (#4093) and set to trigger at about 90% in 0.48.0 (#5292).

  2. Fix 2.

    Run /compact to summarize the chat and free context (official slash command docs), or start a new thread.

    Slash command
    /compact
  3. Fix 3.

    Optionally set the token threshold that triggers automatic compaction (configuration reference).

    TOML
    model_auto_compact_token_limit = 64000

More Codex CLI errors

All 14 Codex CLI errors

FAQ

What does "Codex ran out of room in the model's context window" mean in Codex CLI?

The conversation plus tool output no longer fits in the model's context window. Older builds said "Start a new conversation or clear earlier history before retrying." The server-side error behind it reads "Your input exceeds the context window of this model. Please adjust your input and try again."

How do I fix "Codex ran out of room in the model's context window"?

There are 3 documented fixes. Start with the first: Update Codex. Maintainer etraut-openai (#4926): a number of context-related bugs were fixed and an auto compaction feature was introduced. Auto-compaction was enabled for gpt-5-codex in 0.40.0 (#4093) and set to trigger at about 90% in 0.48.0 (#5292).

Is this Codex CLI error fixed?

Status: Fixed in release. A release fixed this. The affected versions note says where the fix landed. Affected versions: Reported October 2025 (#4926); auto-compaction in 0.40.0+ and ~90% trigger in 0.48.0+

Sources

Last verified against 8 sources: official docs, maintainer replies and release notes.

Newsletter

Fixes for the tools you use, weekly

One email per week. New coding agent releases, what broke, and how developers are working around it.