chroma-core/chroma · error · Error
Failed to generate Gemini embeddings
Error message
Failed to generate Gemini embeddings: ${e} What it means
Catch-all wrapper in generate() around the Gemini SDK embedContent call: covers network failures, auth errors, invalid model names, quota limits, or malformed responses. The SDK exception is stringified into the message; type and stack are lost.
Solutions
- Inspect the embedded ${e} text for the Google API error (401, 404 model, 429 quota)
- Verify the API key env var and model name are correct
- Retry with backoff on transient 429/503 errors
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/ccbe65c8708b06d6.
Report an issue: GitHub.
Appendix: source
Thrown at clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts:84
});
}
public async generate(texts: string[]): Promise<number[][]> {
let result;
try {
result = await this.client.models.embedContent({
model: this.modelName,
contents: texts,
config:
this.taskType || this.dimension
? {
...(this.taskType && { taskType: this.taskType }),
...(this.dimension && { outputDimensionality: this.dimension }),
}
: undefined,
});
} catch (e) {
throw new Error(`Failed to generate Gemini embeddings: ${e}`);
}
if (
!result.embeddings ||
!result.embeddings.every((e) => e.values !== undefined)
) {
throw new Error("Failed to generate Gemini embeddings");
}
return result.embeddings.map((e) => e.values as number[]);
}
public static buildFromConfig(
config: GoogleGeminiConfig,
): GoogleGeminiEmbeddingFunction {
return new GoogleGeminiEmbeddingFunction({
modelName: config.model_name,
apiKeyEnvVar: config.api_key_env_var,View on GitHub (pinned to aecdd12c8a)