{"record":{"id":"5e08c837850b79aa","repo":"weaviate/weaviate","slug":"rq-centering-requires-bits-4","errorCode":null,"errorMessage":"RQ centering requires bits=4","messagePattern":"RQ centering requires bits=4","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/vector/compressionhelpers/compression.go","lineNumber":1023,"sourceCode":"\tdistance distancer.Provider,\n\tvectorCacheMaxObjects int,\n\tlogger logrus.FieldLogger,\n\tdimensions int,\n\tbits int,\n\toutputDim int,\n\trounds int,\n\tswaps [][]compression.Swap,\n\tsigns [][]float32,\n\trounding []float32,\n\tmean []float32,\n\tstore *lsmkv.Store,\n\tallocChecker memwatch.AllocChecker,\n\tmakeBucketOptions lsmkv.MakeBucketOptions,\n\ttargetVector string,\n\tvectorForID common.VectorForID[float32],\n) (VectorCompressor, error) {\n\tif mean != nil && bits != 4 {\n\t\treturn nil, errors.New(\"RQ centering requires bits=4\")\n\t}\n\tvar rqVectorsCompressor VectorCompressor\n\tswitch bits {\n\tcase 1:\n\t\tquantizer, err := RestoreBinaryRotationalQuantizer(dimensions, outputDim, rounds, swaps, signs, rounding, distance)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trqVectorsCompressor = &quantizedVectorsCompressor[uint64]{\n\t\t\tquantizer:         quantizer,\n\t\t\tcompressedStore:   store,\n\t\t\tstoreId:           binary.BigEndian.PutUint64,\n\t\t\tloadId:            binary.BigEndian.Uint64,\n\t\t\ttargetVector:      targetVector,\n\t\t\tlogger:            logger,\n\t\t\tmakeBucketOptions: makeBucketOptions,\n\t\t\tvectorForID:       vectorForID,\n\t\t}","sourceCodeStart":1005,"sourceCodeEnd":1041,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/vector/compressionhelpers/compression.go#L1005-L1041","documentation":"RestoreRQCompressor validates persisted state before rebuilding an RQ compressor at startup or during restore: the stored configuration includes centering data (a non-nil mean) but a bits value other than 4. Centered RQ is only implemented for 4-bit quantization, so the on-disk configuration is internally inconsistent and cannot be restored.","triggerScenarios":"Thrown at adapters/repos/db/vector/compressionhelpers/compression.go:1023 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rebuild the index without centering, or with bits=4 if centering is required","Restore from a backup taken when the configuration was consistent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}