Skip to content

Kingy / AI Fix Finder

← All fixes

Ollama request exceeds the available context size

Ollama returned HTTP 400 because the 518-token rendered request exceeded its 512-token allocation. This retained build rejected the input; it did not silently truncate it.

kingy tested

What happened

Symptom

Ollama returned HTTP 400 because the 518-token rendered request exceeded its 512-token allocation. This retained build rejected the input; it did not silently truncate it.

Conditions

Ollama 0.40.5; CPU runner; same pinned Qwen3-4B Q4_K_M weights.

Loopback-only API, full unchanged synthetic source, temperature 0, reasoning disabled, one model/slot, 128-token output cap.

Model-file SHA-256 7485fe6f11af29433bc51cab58009521f205840f5b4ae3a32fa7f92e8534fdf5.

Correction

Increase the effective options.num_ctx for the same local model and request, within its supported context and available memory. This retained correction changed 512 to 2048; loaded-state readback confirmed 2048.

Result

0/3 baseline task passes; 3/3 corrected exact-task passes; 0/1 reverted task passes. The corrected cohort is shared with the other repair for this runtime.

What did not work

The unchanged 518-token request was rejected at a loaded 512-token context.

  1. Increase the effective options.num_ctx for the same local model and request, within its supported context and available memory. This retained correction changed 512 to 2048; loaded-state readback confirmed 2048.
  2. Preserve the full original input and enough output room, then verify every required fact. Here, 2048 was a tested setting for one 518-token synthetic request, not a universal minimum or a memory-fit promise.
  3. Inspect the retained request, loaded context and raw response before applying the correction to your own setup.
Sources & limits

Full Ollama request exceeds the available context size qualification report and limits

Download Ollama and LM Studio evidence ZIP (52,216 bytes; SHA-256 65272c0b665b287961907c19cb085473797ef83706a8ba754373b1847fecfb3b)

Record checked 2026-10-17.

Same agent, one Apple M4 Pro Mac with 24 GiB unified RAM, one Qwen3-4B Q4_K_M artifact. No independent human or second-machine reproduction.

Three baseline failures, three corrected exact-task passes and one reverted failure per repair. The two repairs for each runtime share the identical three corrected attempts; these are six unique corrected generations total, not twelve.

Fixed synthetic task, not a reliability estimate or proof for other models, versions or hardware. No real OOM condition was induced. No Ollama or LM Studio memory-fit calibration is claimed.

Existing weights were reused, with no model download or paid inference. A free official Ollama portable runtime was added; runtime binaries and weights are excluded from the evidence ZIP.

CPU-only, num_gpu=0, one parallel request, four threads. Corrected responses reported done=true and done_reason=stop, with output below the 128-token cap.

The early lookup probes omitted an explicit thread setting and are exploratory. The qualified lookup baseline was repeated with the final fixed options, including num_thread=4.

This still happens?

Send the smallest example that reproduces it. Use a public, non-sensitive example; leave out account details, keys and private files.

Help improve this tool

Did this help you finish?

About AI Fix Finder. Your feedback goes to Kingy’s private review queue.

Your experience with AI Fix Finder
What happened?