chroma-core/chroma · error · Error
The DefaultEmbeddingFunction's 'model' cannot be changed…
Error message
The DefaultEmbeddingFunction's 'model' cannot be changed after initialization.
What it means
validateConfigUpdate() on the default ONNX embedding function rejects any update that changes `model_name`. The local ONNX model is fixed at initialization; changing it would invalidate all existing embeddings in the collection.
Solutions
- Keep model_name the same in the update or leave it out
- Create a new DefaultEmbeddingFunction with the desired model and a new collection
- Use getConfig() to confirm current model/revision before updating
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at clients/new-js/packages/ai-embeddings/default-embed/src/index.ts:115 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/b85d96f7ef8448d7.
Report an issue: GitHub.
Appendix: source
Thrown at clients/new-js/packages/ai-embeddings/default-embed/src/index.ts:115
return "cosine";
}
public supportedSpaces(): EmbeddingFunctionSpace[] {
return ["cosine", "l2", "ip"];
}
public getConfig(): DefaultEmbeddingFunctionConfig {
return {
model_name: this.modelName,
revision: this.revision,
dtype: this.dtype,
quantized: this.quantized,
};
}
public validateConfigUpdate(newConfig: DefaultEmbeddingFunctionConfig): void {
if (this.getConfig().model_name !== newConfig.model_name) {
throw new Error(
"The DefaultEmbeddingFunction's 'model' cannot be changed after initialization.",
);
}
}
public static validateConfig(config: DefaultEmbeddingFunctionConfig): void {
validateConfigSchema(config, "transformers");
}
}
View on GitHub (pinned to aecdd12c8a)