chroma-core/chroma · error
Error calling Chroma Embedding API: ${error.message}
Error message
Error calling Chroma Embedding API: ${error.message} What it means
Top-level error from ChromaCloudQwenEmbeddingFunction.generate(): any Error thrown inside the request block — fetch network failures, response.json() parse failures on non-JSON bodies (HTML error pages), or the inner "Failed to generate embeddings." check — is caught and re-wrapped with the prefix "Error calling Chroma Embedding API:" plus the original message. Read the suffix to find the real cause: network errors mention fetch/ENOTFOUND, parse errors mention JSON, and the bare suffix "Failed to generate embeddings." means the API answered with a JSON body lacking embeddings.
Source
Thrown at clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts:139
texts,
instructions: instruction,
};
try {
const response = await fetch(this.url, {
method: "POST",
headers: this.headers,
body: JSON.stringify(snakeCase(body)),
});
const data = (await response.json()) as ChromaCloudEmbeddingsResponse;
if (!data || !data.embeddings) {
throw new Error("Failed to generate embeddings.");
}
return data.embeddings;
} catch (error) {
if (error instanceof Error) {
throw new Error(`Error calling Chroma Embedding API: ${error.message}`);
} else {
throw new Error(`Error calling Chroma Embedding API: ${error}`);
}
}
}
public async generateForQueries(texts: string[]): Promise<number[][]> {
if (texts.length === 0) {
return [];
}
let instruction = "";
if (this.task && this.task in this.instructions) {
instruction =
this.instructions[this.task][ChromaCloudQwenEmbeddingTarget.QUERY];
}
const body: ChromaCloudEmbeddingRequest = {View on GitHub (pinned to aecdd12c8a)
Solutions
- Read the suffix after the colon: it names the underlying failure — fix that (network, key, or model).
- For network causes, verify connectivity to the embed endpoint and proxy settings (HTTPS_PROXY).
- For "Failed to generate embeddings." suffix, fix the API key / model as per that error.
- Add retry with backoff around generate() for transient network failures; batch texts so one retry does not re-embed everything.
Defensive patterns
Strategy: retry
Try / catch
async function embedWithRetry(ef: { generate(t: string[]): Promise<number[][]> }, texts: string[], tries = 3) {
for (let i = 1; i <= tries; i++) {
try {
return await ef.generate(texts);
} catch (e) {
const msg = (e as Error).message;
const transient = /fetch|network|ENOTFOUND|ECONN|timeout/i.test(msg);
if (i === tries || !transient) throw e;
await new Promise((r) => setTimeout(r, 2 ** i * 500));
}
}
throw new Error("unreachable");
} Prevention
- Classify by the suffix after 'Error calling Chroma Embedding API:' before deciding to retry.
- Retry only transient network suffixes; fix key/model for missing-embeddings suffixes.
- Batch texts and checkpoint progress so retries re-embed only the failed batch.
When it happens
Trigger: fetch() rejects: DNS failure, connection refused, TLS errors, offline; response.json() rejects because a proxy/gateway returned HTML; the inner no-embeddings check fired (auth/model/request errors answered as JSON).
Common situations: Corporate proxies intercepting the embed URL; transient network drops during large batch embedding; misconfigured custom embed URL; expired or missing CHROMA_API_KEY causing JSON error bodies.
Related errors
- Error calling Chroma Embedding API: ${error}
- Error calling Cloudflare Workers AI API: ${error.message}
- Error calling Jina AI API: ${error.message}
- Failed to generate embeddings.
- Error calling Cloudflare Workers AI API: ${error}
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/71e8cac4ae380fbf.
Report an issue: GitHub.