chroma-core/chroma · error · Error

Failed to generate Mistral embeddings

Error message

Failed to generate Mistral embeddings

What it means

Post-call validation in generate(): the Mistral embeddings response has no `data` array or some entry is undefined — the SDK call resolved but returned an empty/partial payload. Distinct from SDK exceptions, which would propagate unwrapped.

Solutions

  1. Log the raw response to inspect what Mistral returned
  2. Verify model name and API key produce valid responses via a direct API call
  3. Retry once; report to Mistral if the shape is persistently malformed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at clients/new-js/packages/ai-embeddings/mistral/src/index.ts:52 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/7a95e4089677b190. Report an issue: GitHub.

Appendix: source

Thrown at clients/new-js/packages/ai-embeddings/mistral/src/index.ts:52

    if (!apiKey) {
      console.warn(
        `Mistral API key is not set. Please provide it in the constructor or set the environment variable ${apiKeyEnvVar}.`,
      );
    }

    this.model = model;
    this.apiKeyEnvVar = apiKeyEnvVar;
    this.client = new Mistral({ apiKey });
  }

  public async generate(texts: string[]): Promise<number[][]> {
    const response = await this.client.embeddings.create({
      model: this.model,
      inputs: texts,
    });

    if (!response.data || !response.data.every((e) => e !== undefined)) {
      throw new Error("Failed to generate Mistral embeddings");
    }

    return response.data?.map((e) => e.embedding!);
  }

  public defaultSpace(): EmbeddingFunctionSpace {
    return "cosine";
  }

  public supportedSpaces(): EmbeddingFunctionSpace[] {
    return ["cosine", "l2", "ip"];
  }

  public static buildFromConfig(
    config: MistralConfig,
  ): MistralEmbeddingFunction {
    return new MistralEmbeddingFunction({
      model: config.model,

View on GitHub (pinned to aecdd12c8a)