Error reference

Ollama Errors: Model Not Found, Port 11434, GPU and OOM Fixes

Updated July 27, 2026

In short
Almost every Ollama failure is one of five things: the server is not running or the client is pointed at the wrong host (connection refused), the model name does not exist in the registry (model not found, try pulling it first), port 11434 is already bound by an Ollama instance you forgot about, the GPU was not detected so the model silently ran on CPU, or the model plus its context window does not fit in VRAM. Start with ollama ps. It shows what is loaded and whether it is on GPU or CPU, which separates the last two cases immediately.
start here
ollama ps && curl -s http://localhost:11434/api/version
Diagnosis

Causes at a glance

CauseHow to recognize itFix
Server not running or wrong host"connection refused" from the CLI or an SDK on 127.0.0.1:11434Start it with ollama serve (or the desktop app) and set OLLAMA_HOST for remote clients
Port 11434 already bound"listen tcp 127.0.0.1:11434: bind: address already in use"An instance is already running: use it, or stop it before running ollama serve
Wrong model or tag name"model 'x' not found, try pulling it first" or a 404 on pullUse the exact registry name and tag, e.g. llama3.1:8b-instruct-q4_K_M
GPU not detected, silent CPU fallbackollama ps shows "100% CPU"; generation is a few tokens per secondCheck driver/runtime in the server log; fix CUDA/ROCm visibility for the service user
Model plus context exceeds VRAMLoad fails, or ollama ps shows a CPU/GPU split after raising num_ctxUse a smaller quantization or lower num_ctx
Step 1

Step 1: establish whether the server is up

Ollama is a client-server pair. The ollama CLI, the Python and JavaScript SDKs, and any OpenAI-compatible client all talk HTTP to a daemon on port 11434. "Connection refused" always means no daemon is listening at the address the client used, not that a model is missing.

The mirror-image error is "address already in use" when you run ollama serve manually. On macOS and Windows the desktop app already runs the server; on Linux the systemd unit does. That error usually means everything is fine and you should just use the running instance.

By default the daemon binds to 127.0.0.1, so it is unreachable from another machine, from a container, or from WSL against a Windows host. Bind it wider with OLLAMA_HOST=0.0.0.0:11434, and note that this exposes an unauthenticated model API, so keep it behind a firewall or reverse proxy rather than on an open network.

# is anything listening?
curl -s http://localhost:11434/api/version
lsof -i :11434            # macOS/Linux
ss -ltnp | grep 11434     # Linux

# point a client at a remote or non-default host
export OLLAMA_HOST=http://192.168.1.50:11434
ollama list
Step 2

Step 2: fix "model not found" and pull failures

Ollama model references are name:tag, and the tag is not optional in practice, omitting it resolves to :latest, which for many models is a different quantization or size than you expect. ollama run llama3.1 and ollama run llama3.1:70b are different downloads with very different hardware requirements.

"model 'x' not found, try pulling it first" means the name resolved but nothing is stored locally: run ollama pull first, or let ollama run pull it. A 404 during pull means the name or tag does not exist in the registry at all: check the exact string, including the quantization suffix, on the model page.

Third-party GGUF models are addressed differently: prefix the Hugging Face repo path, as in ollama pull hf.co/<user>/<repo>:<quant-tag>. Pull failures that are neither of these are usually network: a corporate TLS-inspecting proxy, or a partial download. ollama rm the model and pull again to clear a truncated blob.

ollama list                       # what is actually stored locally
ollama pull llama3.1:8b-instruct-q4_K_M
ollama show llama3.1:8b-instruct-q4_K_M   # params, context length, template

# a GGUF straight from Hugging Face
ollama pull hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M

# clear a corrupted download
ollama rm llama3.1:8b && ollama pull llama3.1:8b
Step 3

Step 3: get the GPU detected instead of falling back to CPU

Ollama does not fail when it cannot find a GPU; it runs on CPU. The symptom is therefore not an error but a speed collapse: single-digit tokens per second on a machine that should manage many times that. ollama ps names the culprit directly in its PROCESSOR column: "100% GPU", "100% CPU", or a split like "45%/55% CPU/GPU" when only some layers fit.

On NVIDIA, confirm the driver is visible to the *service* user, not just your shell: the systemd unit runs as the ollama user and does not inherit your environment. Missing or mismatched CUDA driver libraries, a container started without --gpus all, and an unset CUDA_VISIBLE_DEVICES in the unit file are the usual causes. On AMD, ROCm support is version- and card-specific, and unsupported GPUs are often forced to work by overriding HSA_OVERRIDE_GFX_VERSION. On Apple Silicon, Metal is used automatically and there is nothing to configure; the equivalent failure is unified memory pressure, not a missing device.

The server log states which runner was selected and why. Restart with OLLAMA_DEBUG=1 and read the inference-compute lines near startup: they name the detected library, the device, and the available VRAM.

ollama ps
# NAME              ID      SIZE     PROCESSOR   UNTIL
# llama3.1:8b       abc123  6.7 GB   100% GPU    4 minutes from now

nvidia-smi                                  # driver visible at all?
sudo systemctl edit ollama.service          # add env for the service user
#   [Service]
#   Environment="OLLAMA_DEBUG=1"
#   Environment="CUDA_VISIBLE_DEVICES=0"
sudo systemctl restart ollama
Step 4

Step 4: size the model and context to your VRAM

Ollama serves quantized GGUF weights, and the quantization tag is the main lever on memory. As a rough guide, a Q4_K_M model occupies a little over half a gigabyte per billion parameters, Q5_K_M somewhat more, and Q8_0 about one gigabyte per billion. An 8B model at Q4_K_M is roughly 4.7 GB of weights; add one to two gigabytes of runtime overhead and the KV cache for your context window on top.

Quality degrades gently down to about 4 bits and sharply below it, so Q4_K_M is the usual sweet spot and Q2 variants are a last resort. If a model does not fit, dropping a size class (a 8B at Q5 instead of a 14B at Q3) generally beats crushing the quantization.

When only part of the model fits, Ollama offloads the remaining layers to CPU rather than failing. That is why performance sometimes falls off a cliff after you raise the context window: a larger num_ctx enlarges the KV cache, which pushes layers off the GPU. ollama ps will show the split.

# check size before pulling
ollama show --modelfile llama3.1:8b

# rough VRAM budget
#   weights (see the SIZE column in `ollama list`)
# + ~1-2 GB runtime overhead
# + KV cache, which grows with num_ctx
# <= your VRAM

Configuring context length with num_ctx

Ollama applies a modest default context window (4096 tokens in current releases) regardless of what the model supports, which is why a 128K-context model can appear to forget the middle of a long document. Raising it is a per-request option, a per-model Modelfile parameter, or a server-wide environment variable, and the request-level option wins.

Raise it deliberately: the KV cache grows linearly with num_ctx, so a large window on a card that was only just fitting the weights will push layers to CPU or fail the load outright. Increase it in steps and re-check ollama ps after each change.

Note that num_ctx is not the same as the model's trained context length. Setting it above what the model was trained for produces degraded output rather than an error; ollama show reports the real context length in the model's metadata.

# interactive session
>>> /set parameter num_ctx 16384

# API request
curl http://localhost:11434/api/generate -d '{
  "model": "llama3.1:8b",
  "prompt": "Summarise this contract...",
  "options": { "num_ctx": 16384, "temperature": 0.2 }
}'

# baked into a model
# Modelfile:
#   FROM llama3.1:8b
#   PARAMETER num_ctx 16384
ollama create llama3.1-16k -f ./Modelfile

# server-wide default
export OLLAMA_CONTEXT_LENGTH=16384

Keep-alive, unloading, and where the logs live

Ollama unloads a model from memory five minutes after its last request by default. If the first call after a pause takes twenty seconds and later calls are instant, you are paying reload time, not inference time. OLLAMA_KEEP_ALIVE changes that window: a duration such as 30m, -1 to keep models resident indefinitely, or 0 to unload immediately after each request. The same value can be sent per request as the keep_alive field.

The mirror problem is too much resident at once. OLLAMA_MAX_LOADED_MODELS caps how many models stay in memory and OLLAMA_NUM_PARALLEL caps concurrent requests per model, each parallel slot needs its own KV cache, so raising it multiplies memory use.

When the error text is not enough, read the server log. On macOS it is ~/.ollama/logs/server.log; on Linux under systemd use journalctl -u ollama; on Windows it is in %LOCALAPPDATA%\Ollama\server.log; in Docker use docker logs. Set OLLAMA_DEBUG=1 before reproducing to get the layer-offload and device-detection detail.

# macOS
tail -f ~/.ollama/logs/server.log

# Linux (systemd)
journalctl -u ollama -f --no-pager

# Windows (PowerShell)
Get-Content $env:LOCALAPPDATA\Ollama\server.log -Wait

# keep models resident
export OLLAMA_KEEP_ALIVE=-1
export OLLAMA_MAX_LOADED_MODELS=2
Beyond the one-off fix

A local model feels free, so it is the easiest way for an agent or a developer to move work off the metered API and out of view: no key, no invoice, no log in the vendor console. That is shadow AI with a friendly interface. Nexus detects unsanctioned model endpoints and agents talking to them, inventories the agents and non-human identities running on developer machines and build hosts, and captures the sessions, tool calls and file changes each one makes, so an Ollama instance running against sensitive repositories is a governed, attributable workload rather than a blind spot.

Explore Swfte Nexus

Common questions

How do I fix "Error: connection refused" in Ollama?
The daemon is not listening where the client is looking. Confirm with `curl http://localhost:11434/api/version`, start the server with `ollama serve` or the desktop app, and if the client is on another machine or in a container, set `OLLAMA_HOST=0.0.0.0:11434` on the server so it binds beyond loopback. Keep that endpoint behind a firewall — it has no authentication.
Why does Ollama say port 11434 is already in use?
Because an Ollama server is already running: the desktop app on macOS and Windows, or the systemd service on Linux, both start one. You usually do not need to run `ollama serve` at all; just use the running instance. If you deliberately want a second one, give it a different port via `OLLAMA_HOST=127.0.0.1:11435`.
Why is Ollama not using my GPU?
Ollama falls back to CPU silently when it cannot initialise a GPU runner. Run `ollama ps` and check the PROCESSOR column: "100% CPU" means no GPU was used, and a split means the model was too large for VRAM so some layers were offloaded. The server log started with `OLLAMA_DEBUG=1` names the detected device and the reason it was rejected.
How do I increase the context window in Ollama?
Set `num_ctx`: with `/set parameter num_ctx 16384` in an interactive session, in the `options` object of an API request, as `PARAMETER num_ctx 16384` in a Modelfile, or globally via `OLLAMA_CONTEXT_LENGTH`. The KV cache grows with it, so re-check `ollama ps` afterwards to confirm the model still fits entirely on the GPU.
How much VRAM does an Ollama model need?
Roughly the model file size shown by `ollama list`, plus one to two gigabytes of runtime overhead, plus a KV cache that scales with `num_ctx` and the number of parallel slots. At Q4_K_M, budget a little over 0.5 GB per billion parameters: about 5 GB for an 8B model at a small context window.