{"record":{"id":"9e5b6f8d6db3dd7b","repo":"chroma-core/chroma","slug":"model-cannot-be-updated","errorCode":null,"errorMessage":"Model cannot be updated","messagePattern":"Model 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":250,"sourceCode":"    const serializedInstructions: Record<string, Record<string, string>> = {};\n    for (const [taskKey, targets] of Object.entries(this.instructions)) {\n      serializedInstructions[taskKey] = {};\n      for (const [targetKey, instruction] of Object.entries(targets)) {\n        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":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts#L232-L268","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait collection.modify({\n  embedding_function: { name: \"chroma-cloud-qwen\", config: { model: \"Qwen/Qwen3-Embedding-0.6B\", task: null } },\n});\n\n// after: create a new collection for a different model\nconst newCol = await client.createCollection({\n  name: \"docs-qwen-v2\",\n  embeddingFunction: new ChromaCloudQwenEmbeddingFunction({\n    model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,\n    task: null,\n  }),\n});","handlingStrategy":"validation","validationCode":"const QWEN_IMMUTABLE = new Set([\"model\", \"task\", \"instructions\"]);\nconst patch = { ...desiredUpdate };\nfor (const k of Object.keys(patch)) {\n  if (QWEN_IMMUTABLE.has(k)) delete patch[k]; // or throw with a clear message\n}\nif (Object.keys(patch).length === 0) {\n  throw new Error(\"Nothing updatable in payload; model is fixed at creation\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"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"}