Error: invalid model name means the text you gave Ollama as a model name breaks its naming rules, so it never got as far as looking the model up. Copy the name from ollama list or from the model's page in the library: a name, one colon, a tag, as in qwen2.5:3b.

The usual culprits are a space (qwen 2.5, typed from a display name), a doubled colon, a slash where the colon belongs, and punctuation such as !. Upper case is not one of them: Qwen2.5:3B worked in the same test.

The error

PS> ollama run "qwen 2.5"
Error: invalid model name
PS> ollama run qwen2.5::3b
Error: invalid model name
PS> ollama pull "qwen 2.5"
Error: 400 Bad Request: invalid model name

Why it happens

A model reference has up to four parts, host/namespace/model:tag, and Ollama fills in registry.ollama.ai, library and latest for the parts you leave out. In the Ollama source (types/model/name.go) each part must start with a letter, digit or underscore and may continue with letters, digits, underscores and dashes; a dot is allowed in the model and the tag but not in the namespace, a colon only in the host, and each part is 1 to 80 characters. A space fits nowhere.

In qwen2.5::3b the last colon splits off the tag 3b, which leaves qwen2.5: as the model, and a colon is not allowed there. In qwen2.5/3b the slash turns qwen2.5 into a namespace, where the dot is not allowed; that one failed too. ollama run and ollama show printed the short message, while ollama pull added 400 Bad Request, the HTTP status the server returned for the pull request. Every attempt exited with code 1 and downloaded nothing.

The fix

PS> ollama list | findstr "NAME qwen2.5:3b"
NAME                       ID              SIZE      MODIFIED
qwen2.5:3b                 357c53fb659c    1.9 GB    2 minutes ago
PS> ollama show qwen2.5:3b
  Model
    architecture        qwen2
    parameters          3.1B
    context length      32768
    embedding length    2048
    quantization        Q4_K_M
...
PS> ollama run qwen2.5:3b "Reply with the single word ready."
Ready

The NAME column of ollama list is the exact string every command and every client library expects; copy it rather than retyping it. For a model you have not pulled yet, open its page on ollama.com, switch to the tags view and copy the full name:tag. The size goes after the colon: qwen2.5:3b, never qwen 2.5 or qwen2.5/3b. The show output above is cut after its first block.

A name that passes the rules but does not exist fails differently: ollama pull reports that the manifest does not exist. And if the message comes from ollama create, look at the FROM line of the Modelfile first: a missing GGUF path produces the same words.

How it was reproduced

On Windows 11 with Ollama 0.40.6 running as the tray app, in Windows PowerShell 5.1, against the app's server on 127.0.0.1:11434. The error block shows three of six attempts; the others were ollama pull qwen2.5::3b, ollama show qwen2.5/3b and ollama show "qwen2.5:3b!", and all six printed the error. The fix was confirmed with ollama show qwen2.5:3b and a one-word ollama run; the model was already on disk, so nothing was downloaded. The naming rules were read in the Ollama source on the day of the test.

Frequently asked

What characters are allowed in an Ollama model name?
Letters, digits, underscores and dashes in every part, plus dots in the model name and the tag. Each part starts with a letter, digit or underscore and is at most 80 characters. One colon separates the model from the tag, as in qwen2.5:3b; spaces are never allowed.
Are Ollama model names case-sensitive?
No. In the test, ollama show Qwen2.5:3B found the local qwen2.5:3b. Use the lowercase form from ollama list anyway, so that your scripts match what the tool prints.
Why does ollama pull say '400 Bad Request: invalid model name'?
The pull request goes to the Ollama server, which checks the name and answers with HTTP status 400. It is the same rule as the shorter message from ollama run; correct the name and pull again.

More decoded errors in the Fixes category. When the name is valid but the registry has no such tag, see pull model manifest: file does not exist.