{"record":{"id":"b8401ad107694612","repo":"chroma-core/chroma","slug":"task-cannot-be-updated","errorCode":null,"errorMessage":"Task cannot be updated","messagePattern":"Task cannot be updated","errorType":"validation","errorClass":"ChromaValueError","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts","lineNumber":254,"sourceCode":"        serializedInstructions[taskKey][targetKey] = instruction;\n      }\n    }\n\n    return {\n      model: this.model,\n      task: this.task,\n      instructions: serializedInstructions as any,\n      api_key_env_var: this.apiKeyEnvVar,\n    };\n  }\n\n  public validateConfigUpdate(newConfig: Record<string, any>): void {\n    if (\"model\" in newConfig) {\n      throw new ChromaValueError(\"Model cannot be updated\");\n    }\n\n    if (\"task\" in newConfig) {\n      throw new ChromaValueError(\"Task cannot be updated\");\n    }\n\n    if (\"instructions\" in newConfig) {\n      throw new ChromaValueError(\"Instructions cannot be updated\");\n    }\n  }\n\n  public static validateConfig(config: ChromaCloudQwenConfig): void {\n    validateConfigSchema(config, NAME);\n  }\n}\n\nregisterEmbeddingFunction(NAME, ChromaCloudQwenEmbeddingFunction);\n","sourceCodeStart":236,"sourceCodeEnd":268,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts#L236-L268","documentation":"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.","triggerScenarios":"Updating the EF config with { task: \"nl_to_code\" } or any payload containing \"task\"; round-tripping a full config snapshot into an update call.","commonSituations":"Deciding later that a collection should use a task-specific instruction; porting creation-time config into modify-time calls.","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: ... }))."],"exampleFix":"// before\nawait collection.modify({\n  embedding_function: { name: \"chroma-cloud-qwen\", config: { task: \"nl_to_code\" } },\n});\n\n// after\nconst ef = new ChromaCloudQwenEmbeddingFunction({\n  model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,\n  task: \"nl_to_code\",\n});\nconst col = await client.createCollection({ name: \"docs-task\", embeddingFunction: ef });","handlingStrategy":"validation","validationCode":"const patch = { ...desiredUpdate };\ndelete patch.task;\nif (Object.keys(desiredUpdate).includes(\"task\")) {\n  console.warn(\"'task' is immutable and was stripped; recreate the collection to change it\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["config","validation","qwen","immutable-field"],"backgroundTag":"immutable-config-update","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}