chroma-core/chroma · error · ChromaValueError
Model cannot be updated
Error message
Model cannot be updated
What it means
Thrown as a ChromaValueError by ChromaCloudQwenEmbeddingFunction.validateConfigUpdate() when an update payload contains the key "model". The cloud model is part of the function's identity: vectors already in the collection were produced by that model, so changing it would make the space inconsistent. Updates must not include model.
Source
Thrown at clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts:250
const serializedInstructions: Record<string, Record<string, string>> = {};
for (const [taskKey, targets] of Object.entries(this.instructions)) {
serializedInstructions[taskKey] = {};
for (const [targetKey, instruction] of Object.entries(targets)) {
serializedInstructions[taskKey][targetKey] = instruction;
}
}
return {
model: this.model,
task: this.task,
instructions: serializedInstructions as any,
api_key_env_var: this.apiKeyEnvVar,
};
}
public validateConfigUpdate(newConfig: Record<string, any>): void {
if ("model" in newConfig) {
throw new ChromaValueError("Model cannot be updated");
}
if ("task" in newConfig) {
throw new ChromaValueError("Task cannot be updated");
}
if ("instructions" in newConfig) {
throw new ChromaValueError("Instructions cannot be updated");
}
}
public static validateConfig(config: ChromaCloudQwenConfig): void {
validateConfigSchema(config, NAME);
}
}
registerEmbeddingFunction(NAME, ChromaCloudQwenEmbeddingFunction);
View on GitHub (pinned to aecdd12c8a)
Solutions
- Remove "model" from the update payload — it is fixed at creation time.
- To use a different model, create a new collection with a new embedding function and re-index.
- Send only genuinely mutable keys in update payloads.
Example fix
// before
await collection.modify({
embedding_function: { name: "chroma-cloud-qwen", config: { model: "Qwen/Qwen3-Embedding-0.6B", task: null } },
});
// after: create a new collection for a different model
const newCol = await client.createCollection({
name: "docs-qwen-v2",
embeddingFunction: new ChromaCloudQwenEmbeddingFunction({
model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,
task: null,
}),
}); Defensive patterns
Strategy: validation
Validate before calling
const QWEN_IMMUTABLE = new Set(["model", "task", "instructions"]);
const patch = { ...desiredUpdate };
for (const k of Object.keys(patch)) {
if (QWEN_IMMUTABLE.has(k)) delete patch[k]; // or throw with a clear message
}
if (Object.keys(patch).length === 0) {
throw new Error("Nothing updatable in payload; model is fixed at creation");
} Prevention
- Never submit full config snapshots as updates; send only intended changes.
- To change model, plan a new collection plus re-index instead of an update.
- Assert payload keys against the immutable set before calling update APIs.
When it happens
Trigger: Attempting to modify the embedding function config with { model: ... } (e.g., via collection modify/config-update flows); submitting a full getConfig() snapshot as an update instead of only mutable fields.
Common situations: Copy-pasting a serialized config into an update call; migrating collections by 'just changing the model', which is not supported; UI/tooling that round-trips whole config objects.
Related errors
- Task cannot be updated
- Instructions cannot be updated
- Config is missing a required field
- The model name cannot be changed after initialization.
- The task type cannot be changed after initialization.
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/9e5b6f8d6db3dd7b.
Report an issue: GitHub.