chroma-core/chroma · error · Error
HTTP ${response.status} ${response.statusText}: ${errorText}
Error message
HTTP ${response.status} ${response.statusText}: ${errorText} What it means
Thrown by ChromaCloudSpladeEmbeddingFunction when the Chroma Embedding API answers with a non-2xx status. Unlike the Qwen package, this one checks response.ok, reads the body as text, and includes HTTP status, statusText, and the raw body in the message — so the API's own error detail (auth failure, bad model, rate limit) is preserved and readable.
Source
Thrown at clients/new-js/packages/ai-embeddings/chroma-cloud-splade/src/index.ts:132
return [];
}
const body: ChromaCloudSparseEmbeddingRequest = {
texts,
task: "",
target: "",
};
try {
const response = await fetch(this.url, {
method: "POST",
headers: this.headers,
body: JSON.stringify(snakeCase(body)),
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(
`HTTP ${response.status} ${response.statusText}: ${errorText}`,
);
}
const data =
(await response.json()) as ChromaCloudSparseEmbeddingsResponse;
// Validate response structure
if (!data || typeof data !== "object") {
throw new Error("Invalid response format: expected object");
}
if (!Array.isArray(data.embeddings)) {
throw new Error(
"Invalid response format: missing or invalid embeddings array",
);
}
View on GitHub (pinned to aecdd12c8a)
Solutions
- Read the status code and body in the message: 401/403 -> fix CHROMA_API_KEY; 429 -> slow down/backoff; 404 -> check URL override; 5xx -> retry later.
- Verify export CHROMA_API_KEY=<valid-key> in every environment using SPLADE.
- Add retry with exponential backoff and jitter for 429/5xx, and reduce batch size.
- Reproduce with curl including the x-chroma-token and x-chroma-embedding-model headers to confirm the API's response.
Defensive patterns
Strategy: retry
Validate before calling
if (!process.env.CHROMA_API_KEY) {
throw new Error("CHROMA_API_KEY must be set for SPLADE embeddings");
} Try / catch
async function spladeWithRetry(gen: () => Promise<SparseVector[]>, tries = 3) {
for (let i = 1; i <= tries; i++) {
try {
return await gen();
} catch (e) {
const msg = (e as Error).message;
const retryable = /HTTP 4(29|01)|HTTP 5\d\d/.test(msg) && !msg.includes("HTTP 401");
if (i === tries || !retryable) throw e;
await new Promise((r) => setTimeout(r, 2 ** i * 500));
}
}
throw new Error("unreachable");
} Prevention
- Set and validate CHROMA_API_KEY in every environment using SPLADE.
- Retry 429/5xx with exponential backoff; fix 401/403 immediately instead of retrying.
- Keep batches small enough to stay under rate limits.
- Parse status code from the message prefix 'HTTP <status>' to drive error handling.
When it happens
Trigger: 401/403 with a missing or invalid CHROMA_API_KEY (constructor sends x-chroma-token from that env var); 404 from a wrong embed URL override; 429 when rate-limited; 5xx during API incidents; request bodies with invalid task/target values.
Common situations: Unset API key in CI/containers (constructor only warns); key revoked; heavy batch embedding hitting rate limits; environment-specific embed URL overrides pointing at the wrong endpoint.
Related errors
- Invalid response format: expected object
- resp.detail || "Unknown error"
- Failed to generate embeddings.
- Error calling Chroma Embedding API: ${error.message}
- Error calling Chroma Embedding API: ${error}
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/d6fe7bbbf89911ff.
Report an issue: GitHub.