{"record":{"id":"9f13351de03a7d5f","repo":"zeroclaw-labs/zeroclaw","slug":"model-requested-cloud-routing-but-ollama-end","errorCode":null,"errorMessage":"Model '{}' requested cloud routing, but Ollama endpoint is local. Configure api_url with a remote Ollama endpoint.","messagePattern":"Model '(.+?)' requested cloud routing, but Ollama endpoint is local\\. Configure api_url with a remote Ollama endpoint\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/ollama.rs","lineNumber":319,"sourceCode":"        zeroclaw_config::schema::build_runtime_proxy_client_with_timeouts(\n            \"model_provider.ollama\",\n            300,\n            10,\n        )\n    }\n\n    fn resolve_request_details(&self, model: &str) -> anyhow::Result<(String, bool)> {\n        let requests_cloud = model.ends_with(\":cloud\");\n        let official_cloud_endpoint = self.is_official_cloud_endpoint();\n        let local_endpoint = self.is_local_endpoint();\n        let normalized_model = if requests_cloud && official_cloud_endpoint {\n            model.strip_suffix(\":cloud\").unwrap_or(model).to_string()\n        } else {\n            model.to_string()\n        };\n\n        if requests_cloud && local_endpoint {\n            anyhow::bail!(\n                \"Model '{}' requested cloud routing, but Ollama endpoint is local. Configure api_url with a remote Ollama endpoint.\",\n                model\n            );\n        }\n\n        if requests_cloud && official_cloud_endpoint && self.api_key.is_none() {\n            anyhow::bail!(\n                \"Model '{}' requested cloud routing, but no API key is configured. Set api_key on [providers.models.ollama.<alias>] or via the schema-mirror grammar.\",\n                model\n            );\n        }\n\n        let should_auth = self.api_key.is_some() && !local_endpoint;\n\n        Ok((normalized_model, should_auth))\n    }\n\n    fn parse_tool_arguments(arguments: &str) -> serde_json::Value {","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/ollama.rs#L301-L337","documentation":"resolve_request_details inspects the model name and the configured base_url on every chat call. A `:cloud` suffix requests Ollama cloud routing, but if the endpoint host is localhost, 127.0.0.1, ::1, or 0.0.0.0, cloud routing is impossible, so the call fails fast before any HTTP request. The check protects against a configuration where the model list and the endpoint disagree about local vs cloud.","triggerScenarios":"model = \"llama3.1:cloud\" with api_url unset (local default) or set to http://localhost:11434; called from chat, chat_with_system, chat_with_history, or chat_with_tools; code that appends \":cloud\" via format! without checking the endpoint.","commonSituations":"Local dev config reusing a cloud-oriented model list; switching api_url back to local but keeping cloud-suffixed model names; provisioning scripts templating the same model string everywhere.","solutions":["Drop the `:cloud` suffix if you mean to use the local Ollama server","Set `api_url = \"https://ollama.com\"` (or your remote endpoint) on the ollama alias when cloud is intended","Audit model-string construction in your code for accidental `format!(\"{}:cloud\", model)` concatenation"],"exampleFix":"# before\n[providers.models.ollama.local]\napi_url = \"http://localhost:11434\"\nmodel = \"llama3.1:cloud\"\n\n# after (local use)\n[providers.models.ollama.local]\napi_url = \"http://localhost:11434\"\nmodel = \"llama3.1\"","handlingStrategy":"validation","validationCode":"fn ollama_model_endpoint_consistent(model: &str, api_url: &str) -> bool {\n    let requests_cloud = model.ends_with(\":cloud\");\n    if !requests_cloud { return true; }\n    let local = reqwest::Url::parse(api_url)\n        .ok()\n        .and_then(|u| u.host_str().map(|h| h.to_string()))\n        .map(|h| matches!(h.as_str(), \"localhost\" | \"127.0.0.1\" | \"::1\" | \"0.0.0.0\"))\n        .unwrap_or(false);\n    !local\n}","typeGuard":"fn requests_ollama_cloud(model: &str) -> bool { model.ends_with(\":cloud\") }","tryCatchPattern":"if requests_ollama_cloud(model) && is_local_endpoint(api_url) {\n    return Err(anyhow::anyhow!(\"model {model} needs a remote api_url for :cloud routing\"));\n}\nollama.chat(req, model, temp).await","preventionTips":["Keep model names free of `:cloud` in local-only profiles","Centralize the `:cloud` suffix decision instead of format! concatenation","Separate local and cloud ollama aliases so endpoint and model stay paired"],"tags":["ollama","cloud-routing","endpoint","validation"],"backgroundTag":"endpoint-configuration-mismatch","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}