tonhowtf/omniget · error · anyhow
ollama pull: HTTP
Error message
ollama pull: HTTP {} What it means
`ollama::pull` POSTs to `{host}/api/pull` with `stream: true`; if the HTTP response status is not a success (2xx), it aborts with 'ollama pull: HTTP <status>'. This surfaces any server-side rejection of the pull request before the streaming progress loop begins.
Solutions
- Check the Ollama server is up: `curl http://localhost:11434/api/version` (adjust host/port).
- Verify the exact model tag exists on the registry (`ollama pull <name>` manually or search ollama.com/library) and retry with the full tag including the size suffix.
- Read the status code: 404 -> fix the model name; 5xx -> check server logs / disk space; 403/407 -> fix proxy configuration.
Example fix
// before
ollama::pull("localhost:11434", "llama3", progress).await?;
// after
let status = reqwest::get("http://localhost:11434/api/version").await;
if status.is_err() {
return Err(anyhow!("ollama server nao esta rodando em localhost:11434"));
}
ollama::pull("localhost:11434", "llama3:8b", progress).await?; Defensive patterns
Strategy: retry
Validate before calling
let base = format!("http://{host}");
let ping = reqwest::Client::new().get(format!("{base}/api/version")).send().await?;
if !ping.status().is_success() {
return Err(anyhow!("ollama server inacessivel em {host}"));
} Try / catch
for attempt in 0..3 {
match ollama::pull(host, name, progress.clone()).await {
Ok(()) => break,
Err(e) if e.to_string().contains("HTTP 5") && attempt < 2 => tokio::time::sleep(std::time::Duration::from_secs(2)).await,
Err(e) => return Err(e),
}
} Prevention
- Health-check the Ollama server (/api/version) before pull/delete operations.
- Use full model tags including size suffix (e.g. llama3.1:8b) verified against ollama.com/library.
- Configure proxy env vars explicitly if the server must reach registry.ollama.ai through a proxy.
When it happens
Trigger: Calling `pull(host, name, progress)` when the Ollama server responds with a non-2xx status: 404 for an unknown model/registry, 400 for a malformed model name, 500 for registry/disk errors, or a proxy returning 502/503.
Common situations: Ollama server not running or at a different port than `base(host)` assumes; typo in the model name (e.g. 'llama3.1' vs 'llama3.1:8b'); corporate proxy blocking registry.ollama.ai; server version too old for the requested model.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/c6f943ff2a5caf58.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/ollama.rs:157
.collect();
}
}
}
st
}
pub async fn pull(host: &str, name: &str, progress: super::ProgressFn) -> anyhow::Result<()> {
use futures::StreamExt;
let b = base(host);
let client = super::client()?;
let id = format!("ollama-pull:{}", name);
let resp = client
.post(format!("{}/api/pull", b))
.json(&serde_json::json!({ "model": name, "stream": true }))
.send()
.await?;
if !resp.status().is_success() {
return Err(anyhow!("ollama pull: HTTP {}", resp.status()));
}
let mut stream = resp.bytes_stream();
let mut buf = String::new();
while let Some(chunk) = stream.next().await {
let chunk = chunk?;
buf.push_str(&String::from_utf8_lossy(&chunk));
while let Some(pos) = buf.find('\n') {
let line = buf[..pos].trim().to_string();
buf.drain(..=pos);
if line.is_empty() {
continue;
}
let v: serde_json::Value = match serde_json::from_str(&line) {
Ok(v) => v,
Err(_) => continue,
};
if let Some(err) = v["error"].as_str() {
return Err(anyhow!("ollama: {}", err));View on GitHub (pinned to 8600b91f42)