{"record":{"id":"04d2de1a8640e09f","repo":"chroma-core/chroma","slug":"instructions-cannot-be-updated","errorCode":null,"errorMessage":"Instructions cannot be updated","messagePattern":"Instructions 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":258,"sourceCode":"    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":240,"sourceCodeEnd":268,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts#L240-L268","documentation":"Thrown as a ChromaValueError by ChromaCloudQwenEmbeddingFunction.validateConfigUpdate() when an update payload contains the key \"instructions\". The instruction strings per task/target are part of how every existing vector in the collection was produced, so they cannot be changed in place.","triggerScenarios":"Attempting to update the EF config with { instructions: {...} }; pasting the output of getConfig() (which serializes instructions) directly into an update payload.","commonSituations":"Tuning prompt-style instructions and trying to apply them to an existing collection; automated tooling that diffs and re-submits whole configs.","solutions":["Remove \"instructions\" from the update payload.","Create a new collection with the customized instructions and re-embed the data.","Pass custom instructions at construction time only."],"exampleFix":"// before\nawait collection.modify({\n  embedding_function: { name: \"chroma-cloud-qwen\", config: { instructions: { nl_to_code: { documents: \"\", query: \"custom\" } } } },\n});\n\n// after\nconst ef = new ChromaCloudQwenEmbeddingFunction({\n  model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,\n  task: \"nl_to_code\",\n  instructions: { nl_to_code: { documents: \"\", query: \"custom\" } },\n});\nconst col = await client.createCollection({ name: \"docs-custom-instr\", embeddingFunction: ef });","handlingStrategy":"validation","validationCode":"const patch = { ...desiredUpdate };\ndelete patch.instructions;\nif (Object.keys(desiredUpdate).includes(\"instructions\")) {\n  console.warn(\"'instructions' is immutable and was stripped; recreate the collection to change it\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass custom instructions only via the constructor.","Keep update payloads minimal (only fields you intend to change).","Version collections when tuning instructions so old and new vectors stay comparable."],"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"}