sigoden/aichat · error
The client doesn't support rerank api
Error message
The client doesn't support rerank api
What it means
This is the default trait implementation of Client::rerank_inner in src/client/common.rs. Clients without a rerank implementation inherit this stub which always fails. Calling rerank() on such a client is guaranteed to error because the provider exposes no rerank capability in this library.
Solutions
- Use a client that implements rerank (e.g. Cohere's rerank API) for reranking steps
- Check provider capability before calling rerank and fall back to another provider
- Implement rerank_inner for your provider if it offers a rerank endpoint
- Skip the rerank stage for providers without support
Example fix
// before let ranked = client.rerank(rerank_data).await?; // fails on non-Cohere clients // after let ranked = cohere_client.rerank(rerank_data).await?;
Defensive patterns
Strategy: fallback
Validate before calling
// capability check before calling
if !client.supports_rerank() { /* skip or route to Cohere */ } Type guard
fn supports_rerank(client: &dyn Client) -> bool {
matches!(client.as_any().downcast_ref::<CohereClient>(), Some(_))
} Try / catch
match client.rerank(data).await {
Err(e) if e.to_string().contains("doesn't support rerank") => {
cohere_client.rerank(data).await
}
r => r,
} Prevention
- Use Cohere (or another rerank-capable client) for rerank stages
- Make rerank optional in RAG pipelines with a graceful skip
- Check capabilities at config load time, not at call time
- Keep a capability matrix of providers in project docs
When it happens
Trigger: Calling client.rerank(data) (rerank -> rerank_inner) on any client that has not overridden rerank_inner — e.g. OpenAI, Claude, or other clients lacking rerank support (Cohere implements it).
Common situations: Building RAG pipelines that assume every provider can rerank, switching providers without checking rerank support, or calling rerank on a chat-only client.
Related errors
- The client doesn't support embeddings 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/98c5b3de881d2171.
Report an issue: GitHub.
Appendix: source
Thrown at src/client/common.rs:148
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)
}
fn patch_request_data(&self, request_data: &mut RequestData) {
let model_type = self.model().model_type();
if let Some(patch) = self.model().patch() {
request_data.apply_patch(patch.clone());
}
let patch_map = std::env::var(get_env_name(&format!(View on GitHub (pinned to 82976d349a)