chroma-core/chroma · error · ChromaValueError
Task cannot be updated
Error message
Task cannot be updated
What it means
Thrown as a ChromaValueError by ChromaCloudQwenEmbeddingFunction.validateConfigUpdate() when an update payload contains the key "task". The task (e.g. nl_to_code) selects the instruction used when generating embeddings; changing it after data is indexed would embed new documents under a different instruction than existing ones, so it is immutable.
Source
Thrown at clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts:254
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
- Drop "task" from the update payload.
- If a different task/instruction setup is needed, create a fresh collection and re-embed.
- Choose task at construction time (new ChromaCloudQwenEmbeddingFunction({ task: ... })).
Example fix
// before
await collection.modify({
embedding_function: { name: "chroma-cloud-qwen", config: { task: "nl_to_code" } },
});
// after
const ef = new ChromaCloudQwenEmbeddingFunction({
model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,
task: "nl_to_code",
});
const col = await client.createCollection({ name: "docs-task", embeddingFunction: ef }); Defensive patterns
Strategy: validation
Validate before calling
const patch = { ...desiredUpdate };
delete patch.task;
if (Object.keys(desiredUpdate).includes("task")) {
console.warn("'task' is immutable and was stripped; recreate the collection to change it");
} Prevention
- Choose task at construction time; treat it as immutable afterward.
- Strip immutable keys from update payloads programmatically.
- Document that task/instruction changes require re-embedding into a new collection.
When it happens
Trigger: Updating the EF config with { task: "nl_to_code" } or any payload containing "task"; round-tripping a full config snapshot into an update call.
Common situations: Deciding later that a collection should use a task-specific instruction; porting creation-time config into modify-time calls.
Related errors
- Model 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/b8401ad107694612.
Report an issue: GitHub.