You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying. #9046
Please use the /feedback slash command to upload your logs and session details for this session, then post the thread ID here.
Edit: Apologies, I just noticed that you included a thread ID. I missed it because of the formatting.
yes, please ,see this -> Uploaded thread: 019bab9f-b98b-7113-9fa8-f439369b7233 @etraut-openai Ok, that is fine. i have the same feeling too. the format is control by your template.
even with the latest release ((v0.98.0), I am getting the same error repeatedly and quite often
■ Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
I just downgraded and pinned my version to v0.80.0 (haha). It has fewer latest skills but works with other models. When I start a new conversation, I don't get the 'Codex ran out of room' warning. @sriinnu
Also had some issues around this. In my case, it seems to be the remote compaction feature. They use /responses/compact, which keeps around every user message ever sent for the whole duration of the entire session history. Only assistant messages, reasoning and some tool calls are really removed.
Maybe, I misunderstand the code, but this seems like an issue for longer threads honestly.
When I run multiple web tool calls (search_query / open / find) in one turn, the context meter in the UI barely moves, and then the turn fails with context_length_exceeded.
From a user perspective, it looks like web-tool context is not reflected in live token usage.
Could this be improved by:
Including web-tool context in the live context meter (or showing a separate hidden/tool-context counter),
Updating the meter after each tool call (not only at turn completion),
Adding a client fallback: on context_length_exceeded, auto-compact and retry once.
This would make token behavior much clearer and prevent surprising failures.
yes, i r right @JiepengLab , i have the same feeling (in point 3, maybe is out of context), but i haven't review the codex code, so that i am not sure.
so, maybe the warning can make more clearly @etraut-openai
While tweaking ~/.codex/config.toml to try or tune, please ensure your parameters align with the actual technical limits of your model. Setting arbitrarily high values can cause unexpected pipeline errors down the line.
To be honest, I haven't seen this issue since 0.116, and I'm moving to 0.141 in the next two days so I probably won't run into it either.
If you want me to help you take a look, I'll need a bit more context. The trace ID can only be accessed by GitHub users with *-oai status (OpenAI employees), so I have to rely on your context to troubleshoot. Could you tell me how many conversation turns there were (so I can estimate the tokens), whether it was a GPT model or another model, and if any MCP tools were used?
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.
Reacted by swoiows, tiklupxgit and Widianto Eka saputro
I meet this error on 0.164.0 when using gpt-6.1-sol.
My original config at ~/.codex/config.toml:
model_auto_compact_token_limit = 900000
model_context_window = 1000000
To me, change the model to gpt-5.6-sol and use /compact. Then change the mode back to 6.1-sol can solve this error.
Confirmed @qsong2001 method worked for me on ChatGPT App Version 26.1027.30824. I just got hit with the same error and my config.toml has the exact same context parameters.
I had 6.1 Sol in EH running for 6h40 mins on doing WebGPU optimizations with Unity and Chrome. It was autonomously testing my game and taking logs. At some point it did not get the chance to auto compact. Switching to 5.6 Sol and sending "/compact" command in the chat immediately worked and context dropped back to 17%. I then switched back to 6.1 Sol EH and sent "resume". It started working from the last saved checkpoint. My project agents.md has a directive that all conversations must regularly save progress in case of failure.
Activity
etraut-openai commentedon Jan 11, 2026
Please use the
/feedbackslash command to upload your logs and session details for this session, then post the thread ID here.Edit: Apologies, I just noticed that you included a thread ID. I missed it because of the formatting.
swoiow commentedon Jan 11, 2026
yes, please ,see this -> Uploaded thread: 019bab9f-b98b-7113-9fa8-f439369b7233
@etraut-openai Ok, that is fine. i have the same feeling too. the format is control by your template.
sriinnu commentedon Feb 6, 2026
even with the latest release ((v0.98.0), I am getting the same error repeatedly and quite often
■ Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
swoiow commentedon Feb 6, 2026
I just downgraded and pinned my version to v0.80.0 (haha). It has fewer latest skills but works with other models. When I start a new conversation, I don't get the 'Codex ran out of room' warning. @sriinnu
alexeichhorn commentedon Feb 6, 2026
Also had some issues around this. In my case, it seems to be the remote compaction feature. They use
/responses/compact, which keeps around every user message ever sent for the whole duration of the entire session history. Only assistant messages, reasoning and some tool calls are really removed.Maybe, I misunderstand the code, but this seems like an issue for longer threads honestly.
JiepengLab commentedon Feb 10, 2026
I’m seeing the same behavior.
When I run multiple web tool calls (
search_query/open/find) in one turn, the context meter in the UI barely moves, and then the turn fails withcontext_length_exceeded.From a user perspective, it looks like web-tool context is not reflected in live token usage.
Could this be improved by:
context_length_exceeded, auto-compact and retry once.This would make token behavior much clearer and prevent surprising failures.
swoiow commentedon Feb 11, 2026
yes, i r right @JiepengLab , i have the same feeling (in point 3, maybe is out of context), but i haven't review the codex code, so that i am not sure.
so, maybe the warning can make more clearly @etraut-openai
siridris commentedon Feb 13, 2026
how can earlier history be cleared
yyyyaaa commentedon Feb 24, 2026
still seeing this in latest version 0.104.0
etraut-openai commentedon Feb 24, 2026
@yyyyaaa, if you have that thread available still, please use
/feedbackto upload its contents and post the thread ID here.yyyyaaa commentedon Feb 27, 2026
@etraut-openai here's one I just had the problem: 019c9db2-f55d-7e70-bc46-3873bb460bad
I noticed that it's always in the middle of tool calling and getting responses from tool calls
18 remaining items
DaviDeMo89 commentedon Jun 18, 2026
Same problem here with codex windows. It started today, it's not compressing
coendeurloo commentedon Jun 18, 2026
Same problem here, twice already
quinncomendant commentedon Jun 18, 2026
Thanks @globalhuman!
I just added this, restarted Codex.app, and it compacted and allowed me to continue:
swoiow commentedon Jun 18, 2026
Hi everyone,
While tweaking
~/.codex/config.tomlto try or tune, please ensure your parameters align with the actual technical limits of your model. Setting arbitrarily high values can cause unexpected pipeline errors down the line.For optimized and realistic configuration values, you can refer to these official examples:
👉 [issues/12100#issuecomment-4285901666]
quinncomendant commentedon Jun 19, 2026
@swoiow Those are not official examples, nor do they include any examples limit values. 🫤
NPT1601 commentedon Jun 21, 2026
also got this error today anyone know how to fix this can't compact it either
swoiow commentedon Jun 21, 2026
To be honest, I haven't seen this issue since 0.116, and I'm moving to 0.141 in the next two days so I probably won't run into it either.
If you want me to help you take a look, I'll need a bit more context. The trace ID can only be accessed by GitHub users with
*-oaistatus (OpenAI employees), so I have to rely on your context to troubleshoot. Could you tell me how many conversation turns there were (so I can estimate the tokens), whether it was a GPT model or another model, and if any MCP tools were used?tiklup11 commentedon Jun 21, 2026
i got this error today
globalhuman commentedon Jun 22, 2026
Try this and update this chat if it's worked for you. It's already helped some others.
#9046 (comment)
tiklup11 commentedon Jun 22, 2026
thanks @globalhuman it didnot help me, i manually ran /compact and it worked
developerisnow commentedon Jun 26, 2026
For me doesn't help ran /compact
etraut-openai commentedon Jun 29, 2026
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
/feedbackand open a new bug report.qsong2001 commentedon Oct 24, 2026
I meet this error on 0.164.0 when using gpt-6.1-sol.
My original config at ~/.codex/config.toml:
model_auto_compact_token_limit = 900000
model_context_window = 1000000
To me, change the model to gpt-5.6-sol and use /compact. Then change the mode back to 6.1-sol can solve this error.
rolupusoru commentedon Oct 31, 2026
Confirmed @qsong2001 method worked for me on ChatGPT App Version 26.1027.30824. I just got hit with the same error and my config.toml has the exact same context parameters.
I had 6.1 Sol in EH running for 6h40 mins on doing WebGPU optimizations with Unity and Chrome. It was autonomously testing my game and taking logs. At some point it did not get the chance to auto compact. Switching to 5.6 Sol and sending "/compact" command in the chat immediately worked and context dropped back to 17%. I then switched back to 6.1 Sol EH and sent "resume". It started working from the last saved checkpoint. My project agents.md has a directive that all conversations must regularly save progress in case of failure.