level=WARN source=llama_server.go:344 msg="truncating input prompt" limit=2050 prompt=5659 keep=4 new=2050 — the prompt was longer than the context window the model was loaded with, so Ollama cut it to fit, without any error in the API reply. The answer then misses whatever was cut. Raise num_ctx in the request options above the prompt number in that log line.

The two numbers say it all: prompt=5659 tokens arrived, limit=2050 fitted. In the test, adding "options":{"num_ctx":8192} made the warning go away and the model answered correctly.

The error

The API call itself succeeds. The only trace is in the server log (server.log of the Windows app, or the output of ollama serve):

time=2026-11-06T13:02:00.056+05:30 level=WARN source=llama_server.go:344 msg="truncating input prompt" limit=2050 prompt=5659 keep=4 new=2050

The reply to that request, read in PowerShell:

PS> curl.exe -s http://127.0.0.1:15190/api/generate -d '@long-prompt.json'   (no options)
response: AMS
prompt_eval_count: 2050

Why it happens

The test prompt opened with "The room code is BLUE-4471.", then repeated one filler sentence 400 times (33,315 characters), and ended by asking for the room code. Without options the request was evaluated with 2,050 tokens, as both the log and prompt_eval_count show, and the answer was AMS: the code in the first sentence was not in what the model saw. keep=4 and new=2050 in the log describe the shortened prompt; the request does not fail. Sent again later, the reply had the fields model, created_at, response, done, done_reason, context, the counts and the durations, with done_reason stop and no field naming the truncation, so a client only notices from a wrong answer or a prompt_eval_count lower than expected.

The model itself can take more: ollama show qwen2.5:0.5b reports a context length of 32768. The smaller window comes from the context size the model was loaded with, which a request can change with num_ctx.

The fix

PS> curl.exe -s http://127.0.0.1:15190/api/generate -d '@long-prompt-ctx.json'   (options num_ctx 8192)
response: BLUE-4471
prompt_eval_count: 5659

The body is the same plus "options":{"num_ctx":8192}. All 5,659 prompt tokens were evaluated, the answer was right, and no truncating input prompt line appeared. The server reloaded the model for the new size, and its log showed the window per request:

llama_context: n_ctx                 = 32768
llama_context: n_ctx_seq             = 8192
...
slot      release: id  0 | task 0 | stop processing: n_tokens = 5665, truncated = 0

n_ctx is four times n_ctx_seq because this server ran with OLLAMA_NUM_PARALLEL=4 from the user environment (-np 4 in its start line). Pick a num_ctx a little above your longest prompt plus the answer, not the model's maximum. The other route is a shorter prompt: send only the parts the question needs.

How it was reproduced

Ollama 0.40.14 on Windows 11, with a separate test server started by ollama serve on 127.0.0.1:15190 with its own models folder and its log redirected to a file, and qwen2.5:0.5b. The two request bodies were built with ConvertTo-Json in a PowerShell script, sent with curl.exe, and the new log lines after each request were filtered for truncat, num_ctx, KvSize and context. The names in the filler sentence are fictional.

Frequently asked

What does 'truncating input prompt' mean in the Ollama log?
The prompt had more tokens than the context window the model was loaded with. Ollama shortened it to the limit shown in the log line and answered anyway, so part of the prompt never reached the model.
How do I stop Ollama from truncating my prompt?
Pass a larger num_ctx in the request options, for example "options":{"num_ctx":8192}, above the prompt number in the log line. In the test that removed the warning and the full prompt was evaluated.
How can I tell from the API that Ollama truncated the prompt?
Compare prompt_eval_count in the reply with the size you expect. In the test the truncated request reported 2050, the same as the limit in the log; with num_ctx 8192 it reported 5659.

More decoded errors in the Fixes category. Where the Windows server log lives and how to read its load lines is shown in Is Ollama using my GPU?.