{"record":{"id":"f4aa5ec7362e3418","repo":"zed-industries/zed","slug":"error-during-embedding-status-body","errorCode":null,"errorMessage":"error during embedding, status: {:?}, body: {:?}","messagePattern":"error during embedding, status: (.+?), body: (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/open_ai/src/open_ai.rs","lineNumber":1156,"sourceCode":"            }\n        })\n        .boxed())\n}\n\nfn chat_completion_request<RequestBody>(\n    provider_name: &str,\n    api_url: &str,\n    api_key: &str,\n    extra_headers: &CustomHeaders,\n    request: &RequestBody,\n) -> std::result::Result<HttpRequest<AsyncBody>, RequestError>\nwhere\n    RequestBody: Serialize + ?Sized,\n{\n    let body = serde_json::to_string(request).map_err(|error| RequestError::SerializeRequest {\n        provider: provider_name.to_string(),\n        error,\n    })?;\n    HttpRequest::builder()\n        .method(Method::POST)\n        .uri(format!(\"{api_url}/chat/completions\"))\n        .header(\"Content-Type\", \"application/json\")\n        .header(\"Authorization\", format!(\"Bearer {}\", api_key.trim()))\n        .extra_headers(extra_headers)\n        .body(AsyncBody::from(body))\n        .map_err(|error| RequestError::BuildRequestBody {\n            provider: provider_name.to_string(),\n            error,\n        })\n}\n\nasync fn http_response_error(\n    provider_name: &str,\n    response: &mut http_client::Response<AsyncBody>,\n) -> RequestError {\n    let body = match read_response_body(response).await {","sourceCodeStart":1138,"sourceCodeEnd":1174,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/open_ai/src/open_ai.rs#L1138-L1174","documentation":"HTTP failure path in the OpenAI embeddings request: the API responded with a non-success status, and the status plus response body are embedded to expose the actual cause (auth failure, quota, bad model name, rate limit, etc.).","triggerScenarios":"Thrown at crates/open_ai/src/open_ai.rs:1150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the embedded status/body: 401 means bad API key, 429 means rate limit/quota, 404 means unknown embedding model","Verify the API key and embedding model name in settings","Retry after addressing rate limits or outages"],"exampleFix":null,"handlingStrategy":"try-catch","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"}