Ollama Model Not Found: Causes, Fixes and a Fallback
The Ollama model not found error means the server you asked does not have a model under that exact name. Almost every case is one of four things: a typo or missing tag, a model that was never pulled, the wrong server, or a different models folder.

What the error looks like
You will see something close to model 'name' not found, try pulling it first. From the CLI it appears right after ollama run. From code it arrives as an HTTP 404, and an OpenAI SDK pointed at Ollama raises its not-found error. The wording tells you the server is alive and answered; it just has no model by that name.
That detail narrows the search. If the server were down, you would see a connection error instead. So the problem is the name, the contents of the server, or which server you reached.
Fix 1: the name or tag is wrong
Start with the list of what the server actually has:
ollama list
Compare the NAME column with the string in your code, character by character. These are the usual mistakes:
- Missing tag. A bare
nameis read asname:latest. If you pulledname:8b, the request fails. - A different spelling, such as a dash instead of a dot in a version.
- A namespaced model. Community models may need a prefix like
user/name. - A custom model made with
ollama create, which has the name you chose, not the base model's.
Copy the name from the list rather than retyping it.
Fix 2: the model was never pulled, or was removed
Calling the API for a model that is not on disk does not always download it. Pull it explicitly:
ollama pull <model>:<tag>
Disk cleanup is a quiet cause. If you ran ollama rm to free space, or a cleanup script cleared the models folder, models vanish and apps that worked yesterday start failing. Check ollama list before you start debugging code.
A failed pull leaves a partial model that does not show up. If the pull errors out with a network or disk message, free some space, rerun the same command and wait for success before testing.
Fix 3: you reached a different server
This is the sneakiest cause. Your terminal and your app may talk to two different Ollama instances.
- Docker. Inside a container,
localhostmeans the container. Use the host address or the container's service name, and make sure the models folder is a mounted volume, otherwise pulled models vanish when the container is recreated. - OLLAMA_HOST. If this variable is set in one shell but not in another, the CLI and your app target different addresses.
- Linux service. The systemd service runs as its own user, with its own models folder, so a model pulled as your user is invisible to the service. Pull through the same service you call.
- Remote machine. A model pulled on your laptop does not exist on the server your app calls.
To check quickly, ask the exact URL your app uses what it holds:
curl -s http://localhost:11434/api/tags
Change the host to the one in your app's config. If the name is not in that reply, that server needs the pull.
Fix 4: the models folder moved
Ollama reads models from a directory. For a user install on macOS and Linux it sits under ~/.ollama/models. The OLLAMA_MODELS variable overrides that. If the variable was set when you pulled and is missing now (a new terminal, a restart, a service that does not inherit it), Ollama looks in the default folder and finds nothing. Set it in the same place every time, or move the folder back.
Keep the app running with a hosted fallback
While you debug, or as a standing safety net, send traffic to a hosted OpenAI-compatible endpoint when the local call fails. The API at https://api.uncensoredollamamodel.com/v1 accepts the same request shape, with the model id uncensored.
import os
from openai import OpenAI, NotFoundError, APIConnectionError, RateLimitError
local = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama", timeout=60)
hosted = OpenAI(
base_url="https://api.uncensoredollamamodel.com/v1",
api_key=os.environ["API_KEY"],
)
def chat(messages, local_model="mystory:latest"):
try:
r = local.chat.completions.create(model=local_model, messages=messages)
return r.choices[0].message.content
except (NotFoundError, APIConnectionError) as exc:
print(f"local unavailable ({type(exc).__name__}), using hosted")
r = hosted.chat.completions.create(model="uncensored", messages=messages)
return r.choices[0].message.content
print(chat([{"role": "user", "content": "Give me a one-line villain introduction."}]))
The fallback catches both not-found errors and a dead local server. Keep it narrow: do not catch every exception, or you will hide real bugs such as a bad request body.
Two things to weigh. First, the fallback sends prompts to a third party, so read the privacy page; prompts are not used for training. Second, the hosted model is a different model from your local one, so tone and length will differ. Test both with your prompts. The hosted model is a single open-weight model from an independent provider, with a 100,000-token context window.
A five-minute checklist
When the error appears and you do not yet know why, work through these in order. Each step rules out one cause.
- Run
ollama listin the same environment as your app (same user, same container, same host). Is the model there? - Does the name in your code match the NAME column exactly, tag included?
- Query the URL your app uses with
/api/tags. Is the model there, on that server? - Print
OLLAMA_HOSTandOLLAMA_MODELSin the process that runs the server. Do they match what you expect? - Pull the model again and watch for errors such as a full disk or a dropped connection.
- Restart the server and repeat the call.
If every step passes and the error remains, copy the exact error text and the request body into your notes before you ask anyone for help. The model name in the message and the model name in your request are the two lines that usually reveal the mismatch.
It also helps to pin the name in one place in your code, a constant or a config entry, rather than repeating it in many files. Then a rename means changing one line, and you can print that value on startup.
Costs and limits of the fallback
The hosted route is billed per token from prepaid credit: $0.15 per 1M input and $0.50 per 1M output tokens. A fallback reply with 800 input and 300 output tokens costs 800 x 0.15 / 1,000,000 + 300 x 0.50 / 1,000,000 = $0.00012 + $0.00015 = $0.00027. Credit never expires, so a small balance can sit idle until the day you need it. See pricing for top-up amounts ($20 to $500) and bonuses.
A full key allows 8 concurrent requests and 300 requests per minute. When a limit is hit, the API returns HTTP 429 with rate_limited or concurrency; on temporary overload it returns 429 with a Retry-After: 5 header, so wait and retry. The docs explain the headers. For another pass on integration habits, our article on common mistakes is a good companion. Try it with the $0.50 trial credit on the API key page.
More guides
Frequently asked questions
Why does ollama run work but my app says model not found?
They probably reach different servers, or the app uses a different name. Check OLLAMA_HOST, container networking and whether the model name includes its tag.
Do I need the tag in the model name?
A bare name is treated as name:latest. If you pulled a different tag such as 8b, you must request that tag explicitly.
Will the API pull a missing model automatically?
Do not count on it. Pull with ollama pull and confirm it appears in ollama list before calling it.
Is a hosted fallback a drop-in replacement?
The request format is the same, but the model is different. Change the base URL, key and model id (uncensored), and review the output for tone and length.
Your API key is ready
Sign up, retrieve your key, and update your base URL. That is all you need to do.
Begin with trial credit
Enter email and password to receive your key instantly.
Summary
- Run ollama list and copy the model name exactly, tag included.
- A 404 "model not found" from the API means the model is not pulled on that server.
- Containers, services and remote hosts often point at a different Ollama than your terminal.
- A hosted fallback keeps an app running while you fix the local setup.