tonhowtf/omniget · error · anyhow

ollama

Error message

ollama: {}

What it means

During a streaming pull, each NDJSON line is parsed and inspected for an `error` field; when present, `pull` returns 'ollama: <server error message>'. This propagates an in-band error reported by the Ollama server inside the 200-OK stream (e.g. pull failures, unknown models).

Solutions

  1. Read the message after 'ollama: ' — it is the server's own explanation; for 'manifest ... does not exist' fix the model name/tag against ollama.com/library.
  2. Free disk space on the Ollama host and retry if the error mentions disk/space.
  3. Retry later if the error indicates registry/network problems; verify server version is current (`ollama -v`).

Example fix

// before
ollama::pull(host, "llama2", progress).await?;
// after
let name = "llama2"; // must exist in registry
if let Err(e) = ollama::pull(host, name, progress).await {
    eprintln!("ollama server recusou o pull de {name}: {e}"); // shows 'ollama: <server error>'
    return Err(e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

let tags = reqwest::Client::new()
    .get(format!("http://{host}/api/tags")).send().await?
    .json::<serde_json::Value>().await?;
let known = tags["models"].as_array().map(|a| a.len()).unwrap_or(0);
// for pull, validate the name against the registry instead:
if name.contains(char::is_whitespace) { return Err(anyhow!("nome de modelo invalido")); }

Try / catch

if let Err(e) = ollama::pull(host, name, progress).await {
    let msg = e.to_string();
    if let Some(server_err) = msg.strip_prefix("ollama: ") {
        eprintln!("servidor recusou o pull: {server_err}"); // surface server's own message
    }
    return Err(e);
}

Prevention

When it happens

Trigger: Calling `pull(host, name, progress)` where the server streams a JSON object with an `error` key, most commonly `{"error":"pull model manifest: file does not exist"}` for a nonexistent model/tag, or disk/permission failures mid-download.

Common situations: Typo in or outdated model name/tag not in the registry; model manifest removed upstream; server ran out of disk space during layer download; registry temporarily unreachable from the server.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/9ddd80c845145d62. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/ollama.rs:175

        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));
            }
            let status = v["status"].as_str().unwrap_or("").to_string();
            let done = v["completed"].as_u64().unwrap_or(0);
            let total = v["total"].as_u64();
            let stage = if status == "success" {
                "done"
            } else {
                "progress"
            };
            super::report(&progress, &id, stage, done, total, Some(status));
        }
    }
    Ok(())
}

pub async fn delete(host: &str, name: &str) -> anyhow::Result<()> {
    let client = super::client()?;
    let resp = client

View on GitHub (pinned to 8600b91f42)