vLLM: The model's max seq len is larger than the maximum number of tokens that can be stored in KV cache / No available memory for the cache blocks (context does not fit in the VRAM)
vLLM won't start because after loading the model there isn't enough graphics memory left for the context cache (KV cache).
The message
ValueError: The model's max seq len (32768) is larger than the maximum number of tokens that can be stored in KV cache (15424). Try increasing `gpu_memory_utilization` or decreasing `max_model_len` when initializing the engine.
Affects: vLLM
Why is this happening?
vLLM reserves a fixed share of the VRAM (--gpu-memory-utilization, default 0.92). Whatever is left after the model weights becomes the KV cache, and at least one request with the full context length must fit there. Without --max-model-len, vLLM uses the maximum context length from the model config, often 32768 tokens or more. If almost nothing is left, for example because another program is using the graphics card, you get "No available memory for the cache blocks" instead.
How to fix it
- Limit the context length, for example
vllm serve <modell> --max-model-len 8192. With--max-model-len auto, vLLM chooses the largest length that fits in memory. - Give vLLM a little more VRAM:
--gpu-memory-utilization 0.95. Write the options with hyphens;--gpu_memory_utilizationwith underscores is not recognized on the command line. - Close other programs that are using the graphics card (for example Ollama, ComfyUI, or a second vLLM instance). vLLM counts occupied memory at startup. Start multiple instances on one card one after another, each only after the previous one has finished loading.
- Use a smaller or quantized model. If you have multiple graphics cards, you can split the model with
--tensor-parallel-size 2. - If you start vLLM from Python, set the same values when creating it:
LLM(model="<modell>", max_model_len=8192, gpu_memory_utilization=0.95).
Set up from scratch again
If it still doesn’t work after that, a fresh setup step by step often helps:
- VRAM explained: why it decides everything
How much VRAM does local AI need? Rule of thumb, quantization (Q4, Q8, fp8), context, image and video models, offloading, and which card si…
Terms for this
Similar errors
- vLLM: Bfloat16 is only supported on GPUs with compute capability of at least 8.0 (graphics card too old for BF16)
- pip: error: externally-managed-environment (Linux/WSL)
- llama.cpp: CUDA error: out of memory
- HostBuffer.read_file_slice failed (crash caused by the new Dynamic VRAM memory management)
- LM Studio: Model loading was stopped due to insufficient system resources
Sources
- https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/discussions/49
- https://github.com/vllm-project/vllm/issues/2248
- https://docs.vllm.ai/en/latest/configuration/engine_args.html
- https://docs.vllm.ai/en/latest/configuration/conserving_memory.html
Checked on Oct 27, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.