LIVE|CLI v0.144.0·model GPT-5.6 Sol·verified 2026-07-09
Codex Insider
The unofficial wire for OpenAI Codex.
community-trackedCLIDesktoppublished Jul 15, 2026 · facts verified Jul 9, 2026
codex — session
$ codex

Your input exceeds the context window of this model. Please adjust your input and try again.

exit code 1
The fix do this first

Start a fresh session — exit and relaunch, or run `codex resume --last` if you need the previous thread back. `/compact` can free space mid-session, but reporters describe it as unreliable on the largest threads, and auto-compaction can hit the same wall. Prevent repeats by muting giant tool output: quiet test reporters, tail long logs, or pipe output to a file and have Codex read it back selectively.

Affected versions: reported on CLI 0.25.0, 0.27.0, and 0.42.0, plus the macOS desktop app (May 2026); no fixed-in release confirmed

Codex halts a task with this full-sentence error, and the confusing part is that it often fires while the context meter still shows plenty of room. That mismatch is the whole story: the error is about one oversized request, not your total budget.

Symptoms

  • A session stops mid-task with this message, sometimes after several automatic retries — one report counted five failed attempts in a row.
  • The context indicator shows headroom when it happens: 32% left in one report, 29% left in another.
  • It reliably follows commands with huge output. A test suite printing 300+ results triggered it, and the same reporter reproduced it with a 3 MB stream of junk output.

Cause

When a shell command returns a giant payload, Codex forwards the result to the model without enforcing a token budget, so a single verbose test run can blow past the window even when accumulated history is modest. The built-in escape hatch has its own failure mode: on long threads, the auto-compaction request can itself exceed the window, looping the same error instead of fixing it. How much room you have in the first place depends on which model you’re running and your plan’s limits.

Fix

  1. Start a new session. The most reliable recovery — exit and relaunch, or use /clear, which starts a new conversation.
  2. Reopen the old thread only if you need it. codex resume --last restores the previous session — useful when the overflow came from one oversized tool call rather than a genuinely full history, and the recovery path a third-party guide recommends.
  3. Try /compact as a fallback. The official command replaces earlier turns with a summary, but the same guide calls it unreliable in current builds — and #24014 shows the automatic version failing outright.
  4. Prevent the repeat by muting tool output. Reporters on #4398 suggest quiet test reporters (--reporter=dot), tailing only the last portion of long logs, or redirecting output to a file and having Codex read slices of it. A bloated AGENTS.md rides along in context too — keep it lean.

Affected versions

Reports span CLI 0.25.0, 0.27.0, and 0.42.0, plus the macOS desktop app in May 2026. We have not found a release note marking this class of error fixed; #4398 was triaged as an enhancement request rather than a bug and has since been closed.

Facts on this page verified July 15, 2026.

Sources
  1. openai/codex #2921 — Input exceeds context window error (fires at 29% context remaining)
  2. openai/codex #4398 — large tool output (300+ tests) triggers the error
  3. openai/codex #2825 — Context window exceeded despite context left
  4. openai/codex #24014 — desktop auto-compaction itself fails with context_length_exceeded
  5. Codex CLI slash commands — /compact (official docs)
  6. Codex CLI reference — codex resume --last (official docs)
  7. SmartScope — third-party fix guide for this error