{"record":{"id":"104a124dc38059a5","repo":"zed-industries/zed","slug":"failed-to-connect-to-lm-studio-api","errorCode":null,"errorMessage":"Failed to connect to LM Studio API: {} {}","messagePattern":"Failed to connect to LM Studio API: (.+?) (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/lmstudio/src/lmstudio.rs","lineNumber":310,"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 LM Studio API: {} {}\",\n            response.status(),\n            body,\n        );\n    }\n}\n\npub async fn get_models(\n    client: &dyn HttpClient,\n    api_url: &str,\n    api_key: Option<&str>,\n    _: Option<Duration>,\n    extra_headers: &CustomHeaders,\n) -> Result<Vec<ModelEntry>> {\n    let uri = format!(\"{api_url}/models\");\n    let mut request_builder = HttpRequest::builder()\n        .method(Method::GET)\n        .uri(uri)","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/lmstudio/src/lmstudio.rs#L292-L328","documentation":"Raised when the streaming chat request to LM Studio returns a non-success HTTP status before the SSE stream can be consumed. Means the server is unreachable, rejected the request, or the model is unavailable.","triggerScenarios":"Thrown at crates/lmstudio/src/lmstudio.rs:451 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the LM Studio server is started and reachable at the configured URL","Verify the model name matches one loaded in LM Studio","Retry after confirming server health"],"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-14T00:17:10.932Z"}