{"record":{"id":"9ddd80c845145d62","repo":"tonhowtf/omniget","slug":"ollama","errorCode":null,"errorMessage":"ollama: {}","messagePattern":"ollama: (.+?)","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/ollama.rs","lineNumber":175,"sourceCode":"        return Err(anyhow!(\"ollama pull: HTTP {}\", resp.status()));\n    }\n    let mut stream = resp.bytes_stream();\n    let mut buf = String::new();\n    while let Some(chunk) = stream.next().await {\n        let chunk = chunk?;\n        buf.push_str(&String::from_utf8_lossy(&chunk));\n        while let Some(pos) = buf.find('\\n') {\n            let line = buf[..pos].trim().to_string();\n            buf.drain(..=pos);\n            if line.is_empty() {\n                continue;\n            }\n            let v: serde_json::Value = match serde_json::from_str(&line) {\n                Ok(v) => v,\n                Err(_) => continue,\n            };\n            if let Some(err) = v[\"error\"].as_str() {\n                return Err(anyhow!(\"ollama: {}\", err));\n            }\n            let status = v[\"status\"].as_str().unwrap_or(\"\").to_string();\n            let done = v[\"completed\"].as_u64().unwrap_or(0);\n            let total = v[\"total\"].as_u64();\n            let stage = if status == \"success\" {\n                \"done\"\n            } else {\n                \"progress\"\n            };\n            super::report(&progress, &id, stage, done, total, Some(status));\n        }\n    }\n    Ok(())\n}\n\npub async fn delete(host: &str, name: &str) -> anyhow::Result<()> {\n    let client = super::client()?;\n    let resp = client","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/ollama.rs#L157-L193","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Free disk space on the Ollama host and retry if the error mentions disk/space.","Retry later if the error indicates registry/network problems; verify server version is current (`ollama -v`)."],"exampleFix":"// before\nollama::pull(host, \"llama2\", progress).await?;\n// after\nlet name = \"llama2\"; // must exist in registry\nif let Err(e) = ollama::pull(host, name, progress).await {\n    eprintln!(\"ollama server recusou o pull de {name}: {e}\"); // shows 'ollama: <server error>'\n    return Err(e);\n}","handlingStrategy":"try-catch","validationCode":"let tags = reqwest::Client::new()\n    .get(format!(\"http://{host}/api/tags\")).send().await?\n    .json::<serde_json::Value>().await?;\nlet known = tags[\"models\"].as_array().map(|a| a.len()).unwrap_or(0);\n// for pull, validate the name against the registry instead:\nif name.contains(char::is_whitespace) { return Err(anyhow!(\"nome de modelo invalido\")); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = ollama::pull(host, name, progress).await {\n    let msg = e.to_string();\n    if let Some(server_err) = msg.strip_prefix(\"ollama: \") {\n        eprintln!(\"servidor recusou o pull: {server_err}\"); // surface server's own message\n    }\n    return Err(e);\n}","preventionTips":["Parse the 'ollama: ' prefix to surface the server's own error text to end users.","Validate model names against the registry catalog before pulling.","Monitor disk space on the Ollama host; most in-band pull errors are manifest-missing or disk-full."],"tags":["ollama","api-error","streaming","pull"],"backgroundTag":"api-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}