Free | No tracking | Every fact with a source|German and English

Error / Models and files

llama-server: the request exceeds the available context size, try increasing it (request longer than the context length)

The llama.cpp server rejects your request with HTTP 400 because the prompt, chat history, and tool descriptions together contain more tokens than the configured context length allows. This is typical with coding assistants and agents that always send the full history along.

The message

srv    send_error: task id = 21, error: the request exceeds the available context size, try increasing it

Affects: llama.cpp

Why is this happening?

When it starts, llama-server reserves a fixed context (-c / --ctx-size). If the request is longer, newer versions no longer trim it automatically; they reject it instead. According to the developer, the program sending the request should do the trimming. Also, the context length is split across the parallel slots (--parallel), so each slot only gets part of it.

How to fix it

  1. Check the log to see how large the request and context are: the line new prompt, n_ctx_slot = …, task.n_tokens = … shows the space per slot and the length of your request.
  2. Start llama-server with a larger context length, for example -c 32768. The value must not be higher than what the model was trained for, and it needs more VRAM.
  3. If you use multiple slots with --parallel, -c is divided by the number of slots. Lower --parallel or raise the context length accordingly.
  4. Enable automatic trimming or summarizing of the history (Context Compaction) in your chat or coding program, or start a new chat.

Better not: Don't raise -c beyond the model's training length just to get rid of the message: that can cause crashes (GGML_ASSERT) or poor answers.

Set up from scratch again

If it still doesn’t work after that, a fresh setup step by step often helps:

Terms for this

Similar errors

Sources

Checked on Oct 28, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.