chroma-core/chroma · error · ChromaValueError

Dimension cannot be updated

Error message

Dimension cannot be updated

What it means

Second guard in validateConfigUpdate(): the update config's `dimension` differs from the output dimensionality the Gemini function was created with. Dimension is immutable because stored embeddings all share it.

Solutions

  1. Keep dimension unchanged in the update config or omit it
  2. Recreate the embedding function (and collection) if a different outputDimensionality is needed
  3. Check getConfig().dimension for the current value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts:130 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/56e55f45c60e4b2e. Report an issue: GitHub.

Appendix: source

Thrown at clients/new-js/packages/ai-embeddings/google-gemini/src/index.ts:130

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

  public getConfig(): GoogleGeminiConfig {
    return {
      api_key_env_var: this.apiKeyEnvVar,
      model_name: this.modelName,
      task_type: this.taskType,
      ...(this.dimension && { dimension: this.dimension }),
    };
  }

  public validateConfigUpdate(newConfig: Record<string, any>): void {
    if (this.getConfig().model_name !== newConfig.model_name) {
      throw new ChromaValueError("Model name cannot be updated");
    }
    if (this.getConfig().dimension !== newConfig.dimension) {
      throw new ChromaValueError("Dimension cannot be updated");
    }
  }

  public static validateConfig(config: GoogleGeminiConfig): void {
    validateConfigSchema(config, NAME);
  }
}

registerEmbeddingFunction(NAME, GoogleGeminiEmbeddingFunction);

View on GitHub (pinned to aecdd12c8a)