How to fix: context length exceeded

Official fix for context length exceeded: run /compress on the session and check /usage; the durable fix is setting model.context_length in config.yaml to your model's real limit.

Who this is for:Anyone hitting the context ceiling after long chats or heavy tool output.

Steps

  1. Compress the current session

    Slash command inside the chat.

    /compress
  2. Check usage and the detected limit

    /usage
  3. Set it explicitly in config.yaml

    Especially for self-hosted/local models, match the server's real capability.

    model:
      context_length: 131072

How to verify

FAQ

Local models hit this more often?

The official FAQ notes that with Custom endpoints (e.g. Ollama) you should set context length to the server's actual capability; auto-detection may be wrong.

Related pages