{"record":{"id":"8d30733c887f3b93","repo":"weaviate/weaviate","slug":"rq-bits-is-immutable-attempted-change-from-v-t","errorCode":null,"errorMessage":"rq bits is immutable: attempted change from \"%v\" to \"%v\"","messagePattern":"rq bits is immutable: attempted change from \"(.+?)\" to \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/vector/hnsw/config_update.go","lineNumber":75,"sourceCode":"\t\t{\n\t\t\tname:     \"multivector enabled\",\n\t\t\taccessor: func(c ent.UserConfig) interface{} { return c.Multivector.Enabled },\n\t\t},\n\t\t{\n\t\t\tname:     \"muvera enabled\",\n\t\t\taccessor: func(c ent.UserConfig) interface{} { return c.Multivector.MuveraConfig.Enabled },\n\t\t},\n\t}\n\n\tfor _, u := range immutableFields {\n\t\tif err := validateImmutableField(u, initialParsed, updatedParsed); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif initialParsed.RQ.Enabled && updatedParsed.RQ.Enabled &&\n\t\tinitialParsed.RQ.Bits != updatedParsed.RQ.Bits {\n\t\treturn errors.Errorf(\"rq bits is immutable: attempted change from \\\"%v\\\" to \\\"%v\\\"\",\n\t\t\tinitialParsed.RQ.Bits, updatedParsed.RQ.Bits)\n\t}\n\n\tif initialParsed.RQ.Enabled && updatedParsed.RQ.Enabled &&\n\t\tinitialParsed.RQ.Centering != updatedParsed.RQ.Centering {\n\t\treturn errors.Errorf(\"rq centering is immutable: attempted change from \\\"%v\\\" to \\\"%v\\\"\",\n\t\t\tinitialParsed.RQ.Centering, updatedParsed.RQ.Centering)\n\t}\n\n\treturn nil\n}\n\ntype immutableParameter struct {\n\taccessor func(c ent.UserConfig) interface{}\n\tname     string\n}\n\nfunc validateImmutableField(u immutableParameter,","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/vector/hnsw/config_update.go#L57-L93","documentation":"When Residual Quantization (RQ) is enabled both before and after an update, the RQ bit width is immutable — changing it invalidates all stored compressed codes. The validator rejects any attempt to change RQ.Bits between the initial and updated configs.","triggerScenarios":"Calling ValidateUserConfigUpdate (via ValidateVectorIndexConfigUpdate or the schema PATCH endpoint) where initialParsed.RQ.Enabled && updatedParsed.RQ.Enabled && initialParsed.RQ.Bits != updatedParsed.RQ.Bits.","commonSituations":"A developer PATCHes the collection schema trying to tune rq.bits (e.g. from 8 to 4) on a compressed collection; infrastructure-as-code drift re-applies an older config with different rq.bits.","solutions":["Keep rq.bits at its existing value in the update request","If a different bit width is truly needed, re-create the collection and re-import vectors with the new compression settings","Disable RQ first if the API permits, then re-enable with new bits, accepting a re-compression cost where supported"],"exampleFix":"// before\n{\"vectorIndexConfig\": {\"rq\": {\"enabled\": true, \"bits\": 4}}}\n// after\n{\"vectorIndexConfig\": {\"rq\": {\"enabled\": true, \"bits\": 8}}} // keep bits unchanged","handlingStrategy":"validation","validationCode":"cur := currentSchema.Classes[i].VectorIndexConfig.(ent.UserConfig)\nif cur.RQ.Enabled && desired.RQ.Enabled && cur.RQ.Bits != desired.RQ.Bits {\n    return errors.New(\"rq.bits is immutable; recreate the collection to change it\")\n}","typeGuard":null,"tryCatchPattern":"if err := client.Schema().Updater().WithClass(updated).Do(ctx); err != nil {\n    if strings.Contains(err.Error(), \"rq bits is immutable\") {\n        // fall back: keep existing bits or recreate collection\n    }\n}","preventionTips":["Read the current schema and echo existing rq.* values in every update payload","Treat compression parameters (rq.bits, rq.centering, pq.*) as create-only","Diff configs client-side and send only mutable fields"],"tags":["go","hnsw","config","compression","rq"],"backgroundTag":"immutable-config-field","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}