ModelNotFoundError
ollama.exceptions.ModelNotFoundError or HTTP 404 from Ollama registry
Stack trace
Error: could not find "qwen2.5" (latest tag) in registry
Error pulling qwen2.5: model qwen2.5 not found in registry: {"errors":[{"code":"NAME_UNKNOWN","message":"repository unknown"}]}
Details:
Calling ollama pull qwen2.5
Response status: 404
Registry: https://registry.ollama.ai Why it happens
Ollama's registry uses specific, case-sensitive model identifiers. The tag 'qwen2.5' does not exist in the official Ollama model registry: the correct identifier is 'qwen2.5:latest' or a specific version tag like 'qwen2.5:7b'. Additionally, Ollama may be trying to fetch from a stale or misconfigured registry endpoint, or the model simply isn't published to the public registry yet.
Detection
Run `ollama list` to see locally cached models. Check `ollama pull qwen2.5 2>&1 | grep -i 'not found'` or check the Ollama logs at `~/.ollama/logs` to capture the exact registry error before it fails.
Causes & fixes
Using incorrect model tag 'qwen2.5' without the size suffix or version specifier
Use the full correct tag: `ollama pull qwen2.5:7b` or `ollama pull qwen2.5:14b` or `ollama pull qwen2.5:32b`. Check the official Ollama model library at https://ollama.ai/library/qwen2.5 for exact available tags.
Ollama registry endpoint is misconfigured, offline, or rate-limited
Verify registry connectivity: `curl -I https://registry.ollama.ai`. If offline, restart Ollama with `ollama serve`. If rate-limited, wait 5 minutes and retry. Check firewall/proxy settings blocking registry.ollama.ai.
Model exists locally but 'ollama pull' is trying to fetch a non-existent remote version
Check local cache: `ollama list | grep qwen`. If present, use it directly with `ollama run qwen2.5:7b`. If pulling a newer version, verify the tag exists on Ollama's registry first.
Using a deprecated Qwen1 or Qwen1.5 model name instead of Qwen2.5
Update to Qwen2.5: `ollama pull qwen2.5:7b`. Do NOT use 'qwen:latest' or 'qwen1.5': these are deprecated. Qwen2.5 is the current stable release (2025).
Code: broken vs fixed
#!/usr/bin/env python3
import subprocess
import os
# BROKEN: Trying to pull a non-existent model tag
model_name = "qwen2.5" # ❌ This tag does not exist in Ollama registry
result = subprocess.run(
["ollama", "pull", model_name],
capture_output=True,
text=True
)
if result.returncode != 0:
print(f"Error: {result.stderr}")
# Error: could not find "qwen2.5" (latest tag) in registry
else:
print(f"Successfully pulled {model_name}") #!/usr/bin/env python3
import subprocess
import os
import time
# FIXED: Use the correct model tag with size specifier
model_name = "qwen2.5:7b" # ✅ Use the full tag with size suffix
max_retries = 3
retry_count = 0
while retry_count < max_retries:
result = subprocess.run(
["ollama", "pull", model_name],
capture_output=True,
text=True,
timeout=600 # 10 min timeout for large model downloads
)
if result.returncode == 0:
print(f"✓ Successfully pulled {model_name}")
break
elif "not found" in result.stderr.lower():
print(f"✗ Model tag '{model_name}' not found in registry.")
print(f" Available tags: qwen2.5:7b, qwen2.5:14b, qwen2.5:32b")
print(f" Verify at: https://ollama.ai/library/qwen2.5")
break
elif "connection" in result.stderr.lower() or result.returncode == 1:
retry_count += 1
if retry_count < max_retries:
print(f"⟳ Registry connection issue, retrying ({retry_count}/{max_retries})...")
time.sleep(5)
else:
print(f"✗ Failed to pull after {max_retries} attempts: {result.stderr}")
else:
print(f"✗ Error: {result.stderr}")
break
# Verify the model is available locally
verify = subprocess.run(
["ollama", "list"],
capture_output=True,
text=True
)
if model_name in verify.stdout:
print(f"✓ Model {model_name} is ready to use") Workaround
If the Ollama registry is unavailable or slow, manually download the Qwen2.5 GGUF file from HuggingFace (e.g., 'TheBloke/Qwen2.5-7B-Instruct-GGUF'), place it in `~/.ollama/models/blobs/`, and create a custom Modelfile pointing to it: `FROM ~/qwen2.5-7b.gguf`. Then run `ollama create qwen2.5:local -f Modelfile` to use the local model without registry access.
Prevention
Always check the official Ollama model library (https://ollama.ai/library/qwen2.5) before pulling to confirm the exact tag format. Pin model versions in your automation: `ollama pull qwen2.5:7b@sha256:<hash>`. Set up a local Ollama mirror or use Ollama's offline mode for CI/CD pipelines to avoid registry failures. Implement health checks: `ollama list` before attempting pulls.