{"record":{"id":"43f87e163d99a141","repo":"zed-industries/zed","slug":"failed-to-connect-to-llama-cpp-api","errorCode":null,"errorMessage":"Failed to connect to llama.cpp API: {} {}","messagePattern":"Failed to connect to llama\\.cpp API: (.+?) (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/llama_cpp/src/llama_cpp.rs","lineNumber":487,"sourceCode":"                            None\n                        } else {\n                            match serde_json::from_str::<ResponseStreamResult>(line) {\n                                Ok(ResponseStreamResult::Ok(response)) => Some(Ok(response)),\n                                Ok(ResponseStreamResult::Err { error }) => {\n                                    Some(Err(anyhow!(error.message)))\n                                }\n                                Err(error) => Some(Err(anyhow!(error))),\n                            }\n                        }\n                    }\n                    Err(error) => Some(Err(anyhow!(error))),\n                }\n            })\n            .boxed())\n    } else {\n        let mut body = String::new();\n        response.body_mut().read_to_string(&mut body).await?;\n        anyhow::bail!(\n            \"Failed to connect to llama.cpp API: {} {}\",\n            response.status(),\n            body,\n        );\n    }\n}\n\n/// Lists the models the server is serving via `GET /v1/models`.\npub async fn get_models(\n    client: &dyn HttpClient,\n    api_url: &str,\n    api_key: Option<&str>,\n    extra_headers: &CustomHeaders,\n) -> Result<Vec<ModelEntry>> {\n    let uri = format!(\"{api_url}/v1/models\");\n    let request = HttpRequest::builder()\n        .method(Method::GET)\n        .uri(uri)","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/llama_cpp/src/llama_cpp.rs#L469-L505","documentation":"The llama.cpp streaming completion HTTP request returned a non-success status; the status and response body are embedded in this error, meaning the local llama.cpp server refused or failed the completion request.","triggerScenarios":"Thrown at crates/llama_cpp/src/llama_cpp.rs:541 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the llama.cpp server is running and the API URL/port is correct","Check that the model is loaded on the server","Retry if the server was temporarily overloaded or restarting","Inspect the logged status code and body for the server-side error"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}