Skip to content

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

Closed

Description

@swoiow

What version of Codex is running?

v0.80.0

What subscription do you have?

i just at the begining of the chat, with one question.

Which model were you using?

other

What platform is your computer?

win-x64

What issue are you seeing?

Image

What steps can reproduce the bug?

Uploaded thread: 019bab9f-b98b-7113-9fa8-f439369b7233

现在的lua新增路由的时候,是会处理upstream下面所有的路由吗?譬如```--- 1. 更新路由: xx/v1/sync/ ---
  路由结果: {'target': 'http://xx:8000', 'host': 'xx', 'status': 'ok'}``` 访问xx/v1/sync/
  business 是不是相当于访问http://xx:8000/business

What is the expected behavior?

No response

Additional information

💡 Tip: If someone reports the same issue, please use the /feedback slash command to upload your logs. 📝

Activity

  1. added
    bug
    on Jan 11, 2026
  2. etraut-openai commented on Jan 11, 2026

    @etraut-openai
    Contributor

    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.

  3. swoiow commented on Jan 11, 2026

    @swoiow
    Author

    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.

  4. added
    context
    on Jan 12, 2026
  5. sriinnu commented on Feb 6, 2026

    @sriinnu

    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.

  6. swoiow commented on Feb 6, 2026

    @swoiow
    Author

    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

  7. alexeichhorn commented on Feb 6, 2026

    @alexeichhorn

    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.

  8. JiepengLab commented on Feb 10, 2026

    @JiepengLab

    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 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:

    1. Including web-tool context in the live context meter (or showing a separate hidden/tool-context counter),
    2. Updating the meter after each tool call (not only at turn completion),
    3. Adding a client fallback: on context_length_exceeded, auto-compact and retry once.

    This would make token behavior much clearer and prevent surprising failures.

  9. swoiow commented on Feb 11, 2026

    @swoiow
    Author

    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

  10. siridris commented on Feb 13, 2026

    @siridris

    how can earlier history be cleared

  11. yyyyaaa commented on Feb 24, 2026

    @yyyyaaa

    still seeing this in latest version 0.104.0

  12. etraut-openai commented on Feb 24, 2026

    @etraut-openai
    Contributor

    @yyyyaaa, if you have that thread available still, please use /feedback to upload its contents and post the thread ID here.

  13. yyyyaaa commented on Feb 27, 2026

    @yyyyaaa

    @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

  14. 18 remaining items

  15. DaviDeMo89 commented on Jun 18, 2026

    @DaviDeMo89

    Same problem here with codex windows. It started today, it's not compressing

  16. coendeurloo commented on Jun 18, 2026

    @coendeurloo

    Same problem here, twice already

  17. quinncomendant commented on Jun 18, 2026

    @quinncomendant

    I added the following to my ~/.codex/config.toml and haven't had the same issue again.

    Thanks @globalhuman!

    I just added this, restarted Codex.app, and it compacted and allowed me to continue:

    model_auto_compact_token_limit = 200000
  18. swoiow commented on Jun 18, 2026

    @swoiow
    Author

    Hi everyone,

    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.

    For optimized and realistic configuration values, you can refer to these official examples:
    👉 [issues/12100#issuecomment-4285901666]

  19. quinncomendant commented on Jun 19, 2026

    @quinncomendant

    you can refer to these official examples

    @swoiow Those are not official examples, nor do they include any examples limit values. 🫤

  20. NPT1601 commented on Jun 21, 2026

    @NPT1601

    also got this error today anyone know how to fix this can't compact it either

  21. swoiow commented on Jun 21, 2026

    @swoiow
    Author

    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?

  22. tiklup11 commented on Jun 21, 2026

    @tiklup11

    i got this error today

  23. globalhuman commented on Jun 22, 2026

    @globalhuman

    i got this error today

    Try this and update this chat if it's worked for you. It's already helped some others.

    #9046 (comment)

  24. tiklup11 commented on Jun 22, 2026

    @tiklup11

    thanks @globalhuman it didnot help me, i manually ran /compact and it worked

  25. developerisnow commented on Jun 26, 2026

    @developerisnow

    For me doesn't help ran /compact

  26. etraut-openai commented on Jun 29, 2026

    @etraut-openai
    Contributor

    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.

  27. qsong2001 commented on Oct 24, 2026

    @qsong2001

    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.

  28. rolupusoru commented on Oct 31, 2026

    @rolupusoru

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcontext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions