{"record":{"id":"a7875fa00ab42dd7","repo":"chroma-core/chroma","slug":"invalid-response-format-missing-or-invalid-embedd","errorCode":null,"errorMessage":"Invalid response format: missing or invalid embeddings array","messagePattern":"Invalid response format: missing or invalid embeddings array","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/ai-embeddings/chroma-cloud-splade/src/index.ts","lineNumber":146,"sourceCode":"      });\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\n      // Sort the sparse vectors to match Python behavior\n      sortSparseVectors(data.embeddings);\n\n      return data.embeddings;\n    } catch (error) {\n      if (error instanceof Error) {\n        throw new Error(`Error calling Chroma Embedding API: ${error.message}`);\n      } else {\n        throw new Error(`Error calling Chroma Embedding API: ${error}`);\n      }\n    }\n  }\n\n  public async generateForQueries(texts: string[]): Promise<SparseVector[]> {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/chroma-cloud-splade/src/index.ts#L128-L164","documentation":"The Chroma Cloud SPLADE endpoint returned a JSON body whose `embeddings` field is absent or not an array (e.g. an error payload, HTML, or a differently-shaped response). The guard in generate() checks Array.isArray(data.embeddings) before sorting/returning sparse vectors, so any non-array shape fails here.","triggerScenarios":"Thrown at clients/new-js/packages/ai-embeddings/chroma-cloud-splade/src/index.ts:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the raw response body (status code, text) to see what the API actually returned — often an auth or quota error","Verify the endpoint URL and request payload match the current SPLADE sparse-embeddings API contract","Retry after fixing credentials or the API error indicated in the response"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","contentChangedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}