sigoden/aichat · error
The client doesn't support embeddings api
Error message
The client doesn't support embeddings api
What it means
This is the default trait implementation of Client::embeddings_inner in src/client/common.rs. Clients that do not implement the embeddings API inherit this default, which unconditionally fails. Calling embeddings() on such a client therefore always errors — the provider simply has no embeddings capability wired up.
Solutions
- Use a client/provider that implements the embeddings API (e.g. OpenAI) for embedding workloads
- Check the client's capability before calling embeddings and route to a supported provider
- Contribute/implement embeddings_inner for the provider you need
- Restructure the app so embedding generation is decoupled from chat provider choice
Example fix
// before let embeddings = client.embeddings(data).await?; // fails on Claude/Bedrock client // after let embeddings = openai_client.embeddings(data).await?;
Defensive patterns
Strategy: fallback
Validate before calling
// capability check before calling
if !client.supports_embeddings() { /* route to OpenAI */ } Type guard
fn supports_embeddings(client: &dyn Client) -> bool {
// only providers that override embeddings_inner
matches!(client.as_any().downcast_ref::<OpenAIClient>(), Some(_))
} Try / catch
match client.embeddings(data).await {
Err(e) if e.to_string().contains("doesn't support embeddings") => {
openai_client.embeddings(data).await
}
r => r,
} Prevention
- Document which providers implement embeddings_inner
- Route embedding workloads to embedding-capable providers
- Centralize provider capability checks in one config layer
- Add a startup assertion when a workflow requires embeddings
When it happens
Trigger: Calling client.embeddings(data) (embeddings -> embeddings_inner) on any client that hasn't overridden embeddings_inner, e.g. the Bedrock, Claude, or Cohere clients.
Common situations: Generic code that calls embeddings on any Client without checking provider capability, switching a config to a provider that doesn't support embeddings, or copy-pasting embeddings code between providers.
Related errors
- The client doesn't support rerank api
- The model does not support network images
- The model does not support network images
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/bf59d5ed440143b9.
Report an issue: GitHub.
Appendix: source
Thrown at src/client/common.rs:140
async fn chat_completions_inner(
&self,
client: &ReqwestClient,
data: ChatCompletionsData,
) -> Result<ChatCompletionsOutput>;
async fn chat_completions_streaming_inner(
&self,
client: &ReqwestClient,
handler: &mut SseHandler,
data: ChatCompletionsData,
) -> Result<()>;
async fn embeddings_inner(
&self,
_client: &ReqwestClient,
_data: &EmbeddingsData,
) -> Result<EmbeddingsOutput> {
bail!("The client doesn't support embeddings api")
}
async fn rerank_inner(
&self,
_client: &ReqwestClient,
_data: &RerankData,
) -> Result<RerankOutput> {
bail!("The client doesn't support rerank api")
}
fn request_builder(
&self,
client: &reqwest::Client,
mut request_data: RequestData,
) -> RequestBuilder {
self.patch_request_data(&mut request_data);
request_data.into_builder(client)
}View on GitHub (pinned to 82976d349a)