{"record":{"id":"1fc7da30a671f934","repo":"chroma-core/chroma","slug":"failed-to-generate-gemini-embeddings","errorCode":null,"errorMessage":"Failed to generate Gemini embeddings","messagePattern":"Failed to generate Gemini embeddings","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts","lineNumber":91,"sourceCode":"        model: this.modelName,\n        contents: texts,\n        config:\n          this.taskType || this.dimension\n            ? {\n                ...(this.taskType && { taskType: this.taskType }),\n                ...(this.dimension && { outputDimensionality: this.dimension }),\n              }\n            : undefined,\n      });\n    } catch (e) {\n      throw new Error(`Failed to generate Gemini embeddings: ${e}`);\n    }\n\n    if (\n      !result.embeddings ||\n      !result.embeddings.every((e) => e.values !== undefined)\n    ) {\n      throw new Error(\"Failed to generate Gemini embeddings\");\n    }\n\n    return result.embeddings.map((e) => e.values as number[]);\n  }\n\n  public static buildFromConfig(\n    config: GoogleGeminiConfig,\n  ): GoogleGeminiEmbeddingFunction {\n    return new GoogleGeminiEmbeddingFunction({\n      modelName: config.model_name,\n      apiKeyEnvVar: config.api_key_env_var,\n      taskType: config.task_type,\n      dimension: config.dimension,\n    });\n  }\n\n  public defaultSpace(): EmbeddingFunctionSpace {\n    return \"cosine\";","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts#L73-L109","documentation":"Response-shape validation in generate(): the Gemini SDK returned successfully but the result lacked `embeddings` or some entry had undefined `values`. Indicates the API returned an empty/partial result despite a 200 response, or the response shape changed.","triggerScenarios":"Thrown at clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the raw result to see which entries are missing values","Check for empty input strings or unsupported content in the texts array","Retry; if persistent, verify the model name supports embedContent"],"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"}