What this thread does
The problem
Ollama fails before or during an agent turn. Choose the branch from the exact error and the preceding server log, not from the HTTP status alone. Sources fetched for this draft; checked 2026-10-20.
Versions and status
| Reference | Verified scope |
|---|---|
| Ollama 0.40.6 (checked 2026-10-20) | Reference, not a promise to fix every crash |
| Runtime licence | MIT, checked 2026-10-20; model licences and cloud charges are separate |
| Local test model | llama3.2 identifier checked 2026-10-20; replace it with your installed model when reproducing |
What changed
On 2026-10-16 (checked 2026-10-20), the release fixed orphaned Windows runners. On 2026-10-14 (checked 2026-10-20), 0.40.5 (checked 2026-10-20) fixed Responses continuation with custom tool calls. These fixes do not cover every runtime error.
System-memory admission failure
Exact example from chr0n1x's #14557, checked 2026-10-20:
500: model requires more system memory (2.7 GiB) than is available (1.8 GiB)
The quantities vary; these are observed values. Cause can be real host-memory shortage, container limits, or incorrect accounting. dhiltgen requests free -h; chr0n1x's reboot helped temporarily, then failed again.
On Linux, inspect memory and loaded models, then unload an idle test model:
free -h
ollama ps
ollama stop llama3.2
Compare host/container limits; release memory or use a smaller artifact for genuine shortage. Reduce excessive context/parallel allocation using the context guide, checked 2026-10-20. For a standalone server, stop the old instance before this conservative diagnostic setting:
OLLAMA_NUM_PARALLEL=1 OLLAMA_CONTEXT_LENGTH=4096 ollama serve
Variables follow the FAQ, checked 2026-10-20. This diagnostic context may be too small for an agent. Report discrepancies with logs. Do not bypass the admission check, drop system caches blindly or force GPU layers as a universal cure.
Runner exited
Verified exact message in kaifhm's #14429, checked 2026-10-20:
Error: llama runner process has terminated: exit status 2
This is a wrapper for a runner crash. That report's preceding log showed compute-buffer allocation failure and a segmentation fault; other causes need different fixes. Capture the server-side failure and retry a small known model:
journalctl -u ollama --no-pager --follow --pager-end
In another terminal:
ollama run llama3.2 "Reply with OK"
For allocation failure use the memory branch; for a documented fixed regression, upgrade, checked 2026-10-20:
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.40.6 sh
sudo systemctl restart ollama
In that older report rick-github suggested OLLAMA_NEW_ENGINE=1, and kaifhm confirmed success. Do not transplant that historical flag into the current engine transition or promise it fixes every runner exit. Logs follow Troubleshooting, checked 2026-10-20. Preserve the model store.
HTTP 500 or failure after streaming starts
The official Errors page, checked 2026-10-20, defines HTTP 500 as Internal Server Error; it gives the model failed to generate a response as an example JSON error. The cause is in the error field and server logs. Inspect it with a nonstreaming minimal request:
curl -i http://localhost:11434/api/generate -d '{"model":"llama3.2","prompt":"Reply with OK","stream":false}'
Fields follow the generate API; checked 2026-10-20. Fix the payload-specific cause; if only the agent fails, compare requests. Avoid unlimited retries. In a stream, inspect every NDJSON object for error; headers can remain successful after generation fails.
Context overflow
Exact backend text quoted in joemcurry's OpenClaw #34005, checked 2026-10-20:
prompt too long; exceeded max context length by 4 tokens
This cloud-model HTTP 400 indicates oversized input, including history and tools. Start a fresh conversation or compact history/reduce attached content before retrying. Test short local input with ollama run llama3.2 "Reply with OK". Check ollama ps for allocated context, then raise local num_ctx only if the model and memory budget support it. The OpenAI compatibility guide says local context must be configured outside the OpenAI request; checked 2026-10-20. Do not assume changing output-token limits increases input capacity, or that a local context variable enlarges a cloud model's maximum.
GPU discovery failed
Verified exact log in #10781, checked 2026-10-20:
no compatible GPUs were discovered
Discovery can fail from missing driver access, hidden devices or unsupported hardware. The report concerns AMD in a container. Choose fixes by platform. For NVIDIA on Linux, official GPU support and Troubleshooting, checked 2026-10-20, give:
nvidia-smi -L
sudo nvidia-modprobe -u
If discovery stopped specifically after suspend/resume, stop GPU workloads before the documented driver reload:
sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm
Restart Ollama; check ollama ps during generation. For AMD, inspect device access with the troubleshooting guide's ls -lnd /dev/kfd /dev/dri /dev/dri/*; use the hardware page's support table and vendor driver procedure. Do not apply NVIDIA commands to AMD, force an arbitrary GPU override, or equate CPU offload with failure to discover hardware.
Recommendation by constraint
| Evidence | Choose |
|---|---|
| Memory admission | Check host/container limits |
| Crash or 500 | Inspect payload and fatal log |
| Oversized input | Compact before retry |
| Discovery failure | Platform-specific driver checks |
How to migrate
1. Record the error, logs, platform, tag and ollama -v. 2. Preserve model files and settings; apply one matching fix. 3. Restart the daemon if needed; retry a minimal request, then the agent.
What to test
Require a complete short response, then the failing tool conversation. Test client handling of nonstreaming and mid-stream errors. Watch memory and ollama ps.
Pitfalls
Do not assume client wording matches server JSON or apply historical flags blindly.
A prompt to give your agent
Your training data may predate my Ollama release. Read https://docs.ollama.com/troubleshooting, https://docs.ollama.com/api/errors and the linked issue matching my exact error now; do not guess fixes or flags. Compare the server log with the client error. Identify memory admission, runner crash, context overflow or GPU discovery, propose one sourced change with exact commands for my platform, and test a minimal local request before the agent workload. Do not delete my model store or silently switch to cloud.
Limits
No runtime commands or fixes were tested. Evidence is GitHub reports, including historical memory/runner cases with maintainer replies. I could not verify lowercase context length exceeded or GPU not detected as universal native Ollama messages; use the exact sourced variants above.
Started from a post by @chr0n1x, packaged by the editor. Original post