{"record":{"id":"d6fe7bbbf89911ff","repo":"chroma-core/chroma","slug":"http-response-status-response-statustext","errorCode":null,"errorMessage":"HTTP ${response.status} ${response.statusText}: ${errorText}","messagePattern":"HTTP (.+?) (.+?): (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/ai-embeddings/chroma-cloud-splade/src/index.ts","lineNumber":132,"sourceCode":"      return [];\n    }\n\n    const body: ChromaCloudSparseEmbeddingRequest = {\n      texts,\n      task: \"\",\n      target: \"\",\n    };\n\n    try {\n      const response = await fetch(this.url, {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(snakeCase(body)),\n      });\n\n      if (!response.ok) {\n        const errorText = await response.text();\n        throw new Error(\n          `HTTP ${response.status} ${response.statusText}: ${errorText}`,\n        );\n      }\n\n      const data =\n        (await response.json()) as ChromaCloudSparseEmbeddingsResponse;\n\n      // Validate response structure\n      if (!data || typeof data !== \"object\") {\n        throw new Error(\"Invalid response format: expected object\");\n      }\n\n      if (!Array.isArray(data.embeddings)) {\n        throw new Error(\n          \"Invalid response format: missing or invalid embeddings array\",\n        );\n      }\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/chroma-cloud-splade/src/index.ts#L114-L150","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!process.env.CHROMA_API_KEY) {\n  throw new Error(\"CHROMA_API_KEY must be set for SPLADE embeddings\");\n}","typeGuard":null,"tryCatchPattern":"async function spladeWithRetry(gen: () => Promise<SparseVector[]>, tries = 3) {\n  for (let i = 1; i <= tries; i++) {\n    try {\n      return await gen();\n    } catch (e) {\n      const msg = (e as Error).message;\n      const retryable = /HTTP 4(29|01)|HTTP 5\\d\\d/.test(msg) && !msg.includes(\"HTTP 401\");\n      if (i === tries || !retryable) throw e;\n      await new Promise((r) => setTimeout(r, 2 ** i * 500));\n    }\n  }\n  throw new Error(\"unreachable\");\n}","preventionTips":["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."],"tags":["cloud-api","splade","http-error","embeddings","sparse-embeddings"],"backgroundTag":"api-http-error-response","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}