zed-industries/zed · error
Failed to connect to LM Studio API: {} {}
Error message
Failed to connect to LM Studio API: {} {} What it means
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.
Source
Thrown at crates/lmstudio/src/lmstudio.rs:310
None
} else {
match serde_json::from_str::<ResponseStreamResult>(line) {
Ok(ResponseStreamResult::Ok(response)) => Some(Ok(response)),
Ok(ResponseStreamResult::Err { error }) => {
Some(Err(anyhow!(error.message)))
}
Err(error) => Some(Err(anyhow!(error))),
}
}
}
Err(error) => Some(Err(anyhow!(error))),
}
})
.boxed())
} else {
let mut body = String::new();
response.body_mut().read_to_string(&mut body).await?;
anyhow::bail!(
"Failed to connect to LM Studio API: {} {}",
response.status(),
body,
);
}
}
pub async fn get_models(
client: &dyn HttpClient,
api_url: &str,
api_key: Option<&str>,
_: Option<Duration>,
extra_headers: &CustomHeaders,
) -> Result<Vec<ModelEntry>> {
let uri = format!("{api_url}/models");
let mut request_builder = HttpRequest::builder()
.method(Method::GET)
.uri(uri)View on GitHub (pinned to 5a9b9558db)
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/lmstudio/src/lmstudio.rs:451 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/104a124dc38059a5.
Report an issue: GitHub.