zed-industries/zed · error · anyhow::Error

error during embedding, status: {:?}, body: {:?}

Error message

error during embedding, status: {:?}, body: {:?}

What it means

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.).

Source

Thrown at crates/open_ai/src/open_ai.rs:1156

            }
        })
        .boxed())
}

fn chat_completion_request<RequestBody>(
    provider_name: &str,
    api_url: &str,
    api_key: &str,
    extra_headers: &CustomHeaders,
    request: &RequestBody,
) -> std::result::Result<HttpRequest<AsyncBody>, RequestError>
where
    RequestBody: Serialize + ?Sized,
{
    let body = serde_json::to_string(request).map_err(|error| RequestError::SerializeRequest {
        provider: provider_name.to_string(),
        error,
    })?;
    HttpRequest::builder()
        .method(Method::POST)
        .uri(format!("{api_url}/chat/completions"))
        .header("Content-Type", "application/json")
        .header("Authorization", format!("Bearer {}", api_key.trim()))
        .extra_headers(extra_headers)
        .body(AsyncBody::from(body))
        .map_err(|error| RequestError::BuildRequestBody {
            provider: provider_name.to_string(),
            error,
        })
}

async fn http_response_error(
    provider_name: &str,
    response: &mut http_client::Response<AsyncBody>,
) -> RequestError {
    let body = match read_response_body(response).await {

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Check the embedded status/body: 401 means bad API key, 429 means rate limit/quota, 404 means unknown embedding model
  2. Verify the API key and embedding model name in settings
  3. Retry after addressing rate limits or outages
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/open_ai/src/open_ai.rs:1150 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/f4aa5ec7362e3418. Report an issue: GitHub.