Known errors
Stuck for 20 minutes? Copy the exact error, then look it up here.
The server log is the first place to look. macOS: cat ~/.ollama/logs/server.log. Linux: journalctl -u ollama --no-pager --follow --pager-end. Windows: server.log in %LOCALAPPDATA%\Ollama.
Stuck on something an earlier chapter set up? Chapter 1's known errors
Counting tokens
What you see
tokens.mjscannot downloadtokenizer.jsonCause
No internet, or Hugging Face is blocked on your network.Fix
Download the file once from the link the script prints, and save it asqwen3-tokenizer.jsonnext totokens.mjs.Status
Our script.- Qwen3-0.6B tokenizer.json (commit c1899de), opens in a new tabchecked 2026-10-09
What you see
Error: Cannot find module '.../tokens.mjs'fromcount3.shCause
count3.shrunstokens.mjsfrom its own folder, and the file is not there.Fix
Gettokens.mjsandcount3.shfrom Practice and put them in one folder.Status
Seen on our Mac (Node v22.23.2).What you see
The script count and the raw count differCause
Different text reached each one, for example a shell changed a quote or added a newline, or the model is notqwen3:0.6b.Fix
Put the text in a file, one text per line, and runsh count3.sh --fileon it, so both counts read the same line. Check the model name.Status
Our advice. Qwen3 adds no start token, so the two counts should match.- Qwen3-0.6B tokenizer_config.json (commit c1899de), opens in a new tabchecked 2026-10-09
What you see
Chat is raw + 10, not raw + 16Cause
thinkwas left out. Ollama then turns thinking on: the template adds/thinkand no empty think block (16 tokens, not 22).Fix
Send"think": false.Status
In Ollama's code, and seen on our Mac: withthinkleft out, our 6-token question counted 16.- Ollama server/routes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Our script, 2026-10-09
What you see
Chat is much more than raw + 16Cause
The model has a system prompt set in its Modelfile, or you sent one.Fix
ollama show --system qwen3:0.6b.Status
In Ollama's code.- Ollama cmd/cmd.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
--showprints nothing or an errorCause
_debug_render_onlyis a debug option and may change between versions.Fix
Checkollama -vsays 0.35.0. Useollama show --template qwen3:0.6bto read the template instead.Status
In Ollama's code. Not seen on our Mac: on 0.35.0,--showprinted the string.- Ollama api/types.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
The first streamed piece starts with a spaceCause
Many tokens carry their leading space:" strawberry"is one token, ID 72600.Fix
Nothing is wrong. Trim the space when you show the text, if you need to.Status
Seen in our runs oftokens.mjs.- Our script, 2026-10-09
What you see
A raw prompt full of control tokens counts many more tokens than predictedCause
The engine read<|im_start|>as plain text, not as one control token.Fix
Use/api/chat, which builds the template for you. Note the raw count in your README: it shows how the engine reads typed control tokens.Status
Not seen on our Mac: Ollama 0.35.0 read each typed role mark as one control token, 18 and 14 tokens, as predicted.What you see
The script count is higher than raw when your text spells<|im_end|>Cause
tokens.mjscounts the name as plain text; Ollama's engine reads it as one control token, in raw mode and in chat.Fix
Add--specialtotokens.mjs. Never pass user text through unchecked: it can fake a turn.Status
Seen on our Mac:A<|im_end|>Bcounted 8 in our script, 3 raw, 19 through chat.- llama.cpp tools/server/server-context.cpp (master), opens in a new tabchecked 2026-10-09
The loop, stops and seeds
What you see
Nologprobsin the replyCause
You used the OpenAI-compatible route, which does not support them.Fix
Use/api/generateor/api/chatwith"logprobs": true.Status
In Ollama's docs.- Ollama OpenAI compatibility doc (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
The loop's text sits inthinking, notresponseCause
thinkwas left out. Ollama turned thinking on and parsed the raw output for think tags.Fix
Send"think": false.Status
In Ollama's code. Not seen on our Mac: withthinkleft out, our loop's text held no think tags and stayed inresponse.- Ollama server/routes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
message.contentis empty,done_reasonislengthCause
Thinking used the wholenum_predictbudget.Fix
Raisenum_predict, or send"think": false.Status
In Ollama's code, and seen on our Mac: a cap of 64 left the content empty.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
The answer stops mid-sentence,done_reasonislengthCause
Thenum_predictcap. The model never sees it.Fix
Raisenum_predict; ask for a short answer in the prompt instead.Status
In Ollama's code.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
The same words over and over at temperature 0 with thinking onCause
Greedy picking can repeat itself, and Qwen3's makers advise against it for thinking.Fix
Use the model's defaults (temperature 0.6 for thinking), or capnum_predict.Status
In Qwen3's model card. Not seen in our runs: two answers at temperature 0 with thinking on repeated no sentence.- Qwen3-0.6B model card (Qwen team, commit c1899de), opens in a new tabchecked 2026-10-09
What you see
Seed 42 still gives different words on call 1Cause
Call 1 read the whole prompt; later calls reused the cache, and the scores moved slightly.Fix
Expected. Compare calls 2 onward, or send a fresh prompt each time.Status
Seen in a report (still open). Not seen on our Mac: in 3 runs, all 5 calls matched each time.What you see
HTTP 400"<model>" does not support thinkingCause
Not this model: another model gotthink: true.Fix
Useqwen3:0.6b.Status
See chapter 1's known errors: Thinking.
See both phases (Practice)
What you see
Cachedis large inphases-table.mdCause
The prompt started the same way as an earlier one: an old copy ofphases.pywithout the random tag, or another program sent the same ticket.Fix
Use thephases.pyfrom this page, then rerun the table.Status
In Ollama's docs.- Ollama usage doc (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
TTFT jumps on one row onlyCause
That call loaded the model (look atload_msinphases-runs.json).Fix
Rerun the table.Status
See chapter 1's known errors: Practice table.What you see
Formula and total differ by more than 10%Cause
A pause outside the counters, for example another app, or a long first token.Fix
Close other apps and rerun.Status
The formula is NVIDIA's. Not seen on our Mac: at most 1.8% in 108 calls. A 1-token call readeval_duration1000 ns, so it leaves out the first token.- NVIDIA NIM LLM Benchmarking, Metrics (2.0.0), opens in a new tabchecked 2026-10-09
What you see
Output tokensis below the capCause
The model ended its reply first:done_reasonis stop.Fix
Expected. The formula uses the realeval_count.Status
Seen on our Mac.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
TTFT of the long prompt is about 0.1 s more than its prefill timeCause
Before it reads a prompt, the engine saves the last one to its prompt cache in RAM. Your clock counts that wait;prompt_eval_durationdoes not.Fix
Expected: TTFT is what the user waits for.Status
Seen on our Mac: the server log timed that save at 71 to 282 ms.- llama.cpp server README (master), opens in a new tabchecked 2026-10-23
What you see
prompt eval cachedis missing from the secondollama run --verbosesummaryCause
The two runs did not send the same text:ticket.txtwas made again, or the prompt words changed. The line shows only when the cached count is above 0.Fix
Maketicket.txtonce, then run the sameollama runline twice.Status
In Ollama's code.- Ollama api/types.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
The second--verbosesummary shows a tinyprompt eval rateCause
The rate divides only the new, uncached tokens by the time, and the cache left 1 new token.Fix
Readprompt eval durationinstead.Status
In Ollama's code, and seen on our Mac.- Ollama api/types.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
When the prompt does not fit
What you see
HTTP 200, the reply ignores the system prompt,prompt_eval_countisnum_ctx / 2 + 2(258, 1,026, 2,050)Cause
The prompt was longer than the context. Ollama kept the first 4 tokens and the end.Fix
Raisenum_ctx, or shorten the history yourself. Compareprompt_eval_countwith your own count.Status
In Ollama's code, seen in reports, and seen on our Mac: 258 atnum_ctx512.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Ollama issue #17889, a long prompt kept only 2,050 tokens (user report, 2026-08-20), opens in a new tabchecked 2026-10-09
- Ollama issue #17427, the prompt limit is half of num_ctx (user report, 2026-07-27), opens in a new tabchecked 2026-10-09
What you see
Log:truncating input prompt(Warn)Cause
Same cut, as the log shows it, withlimit,prompt,keepandnew.Fix
Same fix.Status
In Ollama's code, and seen on our Mac.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
Old turns of a long chat are missing, no Warn lineCause
Stage 1 dropped whole old messages. It logs only at Debug level.Fix
SetOLLAMA_DEBUG=1the way chapter 1 setOLLAMA_NUM_PARALLELto see it, then undo it the same way (on macOSlaunchctl unsetenv OLLAMA_DEBUG, then restart the app). Keep the chat shorter thannum_ctx.Status
In Ollama's code, and seen in reports (still open).- Ollama server/prompt.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Ollama envconfig/config.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Ollama issue #14259, silent truncation (open since 2026-02-14), opens in a new tabchecked 2026-10-09
- Ollama issue #4967, the API cuts chats without warning (open since 2024-06-10), opens in a new tabchecked 2026-10-09
What you see
HTTP 400the prompt is longer than the context length currently available to the model; ...Cause
You sent"shift": false, so Ollama refuses instead of cutting.Fix
Raisenum_ctxor shorten the prompt.Status
In Ollama's code, and seen on our Mac.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
Log:level=ERROR ... msg="llama-server terminated" error="signal: killed"Cause
Ollama stopped its engine to start one with new settings, such as"shift": false.Fix
Nothing failed: the next lines start the new engine.Status
Seen on our Mac.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
request (7851 tokens) exceeds the available context size (4096 tokens), try increasing itCause
llama-server's own check, seen with imported GGUF models that use their built-in template.Fix
Raisenum_ctx.Status
Seen in a report, and in llama.cpp's code.What you see
"truncate": falsegives an errorCause
No cut, so the engine gets a prompt longer than its context.Fix
Raisenum_ctx.Status
Seen on our Mac: HTTP 400,request (871 tokens) exceeds the available context size (512 tokens), try increasing it.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
No cut and no error, on a newer OllamaCause
In v0.35.0's code, models that run on MLX skip this cut (truncateis forced off for them), and v0.40 runs supported models on MLX by default on Apple Silicon.Fix
The labs follow v0.35.0: checkollama -v, and install 0.35.0 with the commands on Practice's "Before you start" screen.Status
In Ollama's code and release notes. Not verified: v0.40's code.- Ollama server/routes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Ollama v0.40.0 release notes, opens in a new tabchecked 2026-10-09
What you see
CONTEXTis not what the lab expectsCause
The default depends on GPU memory and on the app's context slider.Fix
Our scripts setnum_ctxon every call.Status
In Ollama's code and docs. Our 24 GB Mac:total_vram17.8 GiB, so 4096.- Ollama server/routes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Ollama context length doc (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
vLLM:This model's maximum context length is ... tokens. However, you requested ...Cause
vLLM counts prompt plus requested output and refuses.Fix
Shorten the prompt or lowermax_tokens.Status
In vLLM's code.- vLLM vllm/renderers/params.py (tag v0.31.0), opens in a new tabchecked 2026-10-09
Memory and fit (Practice and Break it)
What you see
ps_budget.shfinds no buffer linesCause
The lines appear only when a model loads, and the log may have rotated.Fix
ollama stop qwen3:0.6b, one call, then run it again.Status
Not seen on our Mac: v0.35.0's log holds the model, KV and compute lines at every load.What you see
NorecommendedMaxWorkingSetSizeline in the logCause
Ollama 0.35.0's log does not print it. llama.cpp prints it when it starts on a Mac.Fix
Readtotal_vramin thevram-based default contextline instead.Status
Seen on our Mac.- llama.cpp ggml-metal-device.m (tag v0.6.0), opens in a new tabchecked 2026-10-09
- Ollama server/routes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
Two model buffer lines, andps_budget.shadds themCause
On a Mac the log gives the GPU part (MTL0) and a small CPU part.Fix
Use theMTL0line: it is on the GPU, andSIZEcounts it.Status
Seen on our Mac.- Ollama llm/llama_server.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
ps_budget.shcannot open the log fileCause
The script reads the macOS log. Linux keeps the log in the system journal, and Windows under%LOCALAPPDATA%\Ollama.Fix
Linux:journalctl -u ollama --no-pager > ollama.log, thenLOG=ollama.log sh ps_budget.sh. Windows: setLOGto that folder'sserver.log.Status
In Ollama's docs.- Ollama troubleshooting doc (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
ollama psSIZE does not match your GiB mathCause
ollama psprints decimal GB with one decimal, the log prints MiB, and your table uses GiB.Fix
Read the exact bytes from/api/psand convert once.Status
In Ollama's code. On our Mac, the three GPU lines summed to 990.95 MiB and/api/pssaid 1,039,086,387 bytes: the same, within the log's rounding.- Ollama format/bytes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
- Ollama cmd/cmd.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
ollama listsays 522 MB, the web page 523 MBCause
ollama listcuts the decimals: 522,653,767 bytes is 522.65 MB.Fix
Nothing is wrong.Status
In Ollama's code.- Ollama format/bytes.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
ollama psPROCESSOR shows a split such as48%/52% CPU/GPUCause
Weights plus cache did not fit the GPU's share, so some layers run on the CPU, slower.Fix
Lowernum_ctx, use a smaller file, or fewer slots.Status
In Ollama's docs.- Ollama FAQ (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
Log:llama-server load failed; reducing automatic context and retrying onceCause
The load ran out of memory, so Ollama tried a smaller default context.Fix
Expected. Setnum_ctxyourself to choose the trade.Status
In Ollama's code.- Ollama server/sched.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
Log:model is too large for system memoryCause
Weights plus cache do not fit at all.Fix
A smaller file or a smallernum_ctx.Status
In Ollama's code.- Ollama server/sched.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
SIZE did not change after a biggernum_ctxCause
The call did not reload the model, or you readollama psbefore the second call.Fix
CheckCONTEXTinollama ps.Status
In Ollama's code. Not seen on our Mac: 16,384 reloaded the model, and SIZE grew.- Ollama server/sched.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
SIZE grew more than the KV cacheCause
Above 4,096 tokens the engine reads the prompt in bigger groups, so its working memory grows too.Fix
Expected. Count working memory in your budget.Status
Seen on our Mac: the GPU compute buffer grew from 50.20 to 146.30 MiB.- Ollama server/sched.go (tag v0.35.0), opens in a new tabchecked 2026-10-09
What you see
Activity Monitor shows the engine using far more memory thanollama psCause
The engine keeps old prompts in RAM, up to 8,192 MiB, and SIZE leaves them out.Fix
Expected. Plan for that RAM when you run many long prompts.Status
Seen on our Mac: 3,537 MiB of RAM after the full phases.py table, with SIZE 1.0 GB.- llama.cpp server README (master), opens in a new tabchecked 2026-10-23
vLLM on a GPU (lesson 5)
What you see
Failed to load model - not enough GPU memory. Try lowering --gpu-memory-utilization ...Cause
The weights alone do not fit the GPU. No cache line comes before it.Fix
A 4-bit or FP8 file, a smaller model, or more GPUs.Status
In vLLM's code, and seen in a report.What you see
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 96.00 MiB ...Cause
The same failure, as PyTorch reports it.Fix
A 4-bit or FP8 file, a smaller model, or more GPUs.Status
Seen in a report.What you see
To serve at least one request with the model's max seq len ...Cause
The weights fit, but the cache for one request at full length does not.Fix
--max-model-lenlower, orauto. The message also gives an estimated maximum.Status
In vLLM's code.- vLLM vllm/v1/core/kv_cache_utils.py (tag v0.31.0), opens in a new tabchecked 2026-10-09
What you see
No available memory for the cache blocks.Cause
Nothing is left for the cache after the weights.Fix
Raise--gpu-memory-utilization, or a smaller model.Status
In vLLM's code.- vLLM vllm/v1/core/kv_cache_utils.py (tag v0.31.0), opens in a new tabchecked 2026-10-09
What you see
Free memory on device ... on startup is less than desired GPU memory utilization ...Cause
Another process holds GPU memory, for example a second engine.Fix
Stop the other process, or lower--gpu-memory-utilization.Status
In vLLM's code.- vLLM vllm/v1/worker/utils.py (tag v0.31.0), opens in a new tabchecked 2026-10-09
Old model files and templates
What you see
missing pre-tokenizer type, using: 'default'thenGENERATION QUALITY WILL BE DEGRADED!Cause
An old GGUF without its model's split rule. Numbers and text split wrongly.Fix
Download a fresh file of the model.Status
In llama.cpp's code, and seen in a report.What you see
... So now the final prompt starts with 2 BOS tokens.Cause
Your text already starts with the start token, and the engine adds another. Happens in raw mode with models that use one (not Qwen3).Fix
Leave the start token out of your raw text.Status
In llama.cpp's code.- llama.cpp src/llama-vocab.cpp (master), opens in a new tabchecked 2026-10-09
From chapter 1
What you see
Failed to connect,Connection refused,fetch failed,model not found(HTTP 404), a timeout, or a broken streamCause
Ollama is not running, the model is not pulled, or the stream was read the wrong way: chapter 1 covers each one.Fix
Open chapter 1's known errors page: Start and connect, Model, Timing and counters.Status
See chapter 1's known errors: Start and connect, Model, Timing and counters.
The check page
What you see
"My answer is close but marked wrong"Cause
The band is ±5%, or the band the item states, or the unit is wrong (GB against GiB).Fix
Read the unit and the band in the question.Status
What you see
"I used my own run's numbers"Cause
The check uses fixed numbers from sources, not your run.Fix
Use the numbers in the question.Status