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

Resolved 💬 3 comments Opened Jun 18, 2026 by ehendrix23 Closed Jun 29, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the Codex App are you using (From “About Codex” dialog)?

26.611.62324

What subscription do you have?

Pro

What platform is your computer?

Darwin 25.5.0 arm64 arm

What issue are you seeing?

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

What steps can reproduce the bug?

Longer session.

Feedback ID: 019eccf6-1871-7201-92d4-cf0b69975590

What is the expected behavior?

Not getting this issue at all.

Additional information

I also noticed that when this happens "Context" shows 0% used for used and 0 tokens used.
When I then run /compact it works for a bit and then it shows values there.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #28920

Powered by Codex Action

foeken · 2 months ago

Same issue here. Remote connection. Thread works fine on 'server' (mac app), and client (mac app), but cli remote says:

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

etraut-openai contributor · 1 month ago

Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use /feedback and open a new bug report.