← All guides

Codex context_window_exceeded or compaction failed: how to continue

Save progress, try compaction, then continue in the same project with a short handoff.

Updated

Start here

Enter /compact in the CLI chat box. If it still fails, start a new chat in the original project and provide a short handoff.

On this page

1. Save work and identify the error

  1. Save edited files and note the goal, completed work and next step. Keep the old chat.
  2. Use this guide for context_window_exceeded or context_length_exceeded. For usage limit, see the allowance guide.

Usage-limit help →

2. Try compaction

  1. Enter the command below in CLI chat and confirm when prompted. In other clients, use compact only if the menu offers it.
  2. Afterward, ask for the goal and next step. If the same error persists, start a new chat.
/compact

3. Start a chat in the same project

  1. Keep the existing files and send the completed handoff below.
  2. If the old chat cannot summarize, use its last messages and actual files. Include only the essentials.
Continue this project:
Goal:
Requirements to keep:
Completed work and files:
Verified results:
Next step:
Check the actual files and existing results before continuing.

4. Continue in smaller steps

  1. Have the new chat complete one small task before proceeding.
  2. Provide files and nearby error logs as needed, and save a brief progress note after each stage.

5. Contact support

  1. Send the client version, model, error screenshot and results from compaction and the new chat.
  2. Keep the project files so support can help investigate.

Contact support →

Useful links