{"record":{"id":"a945a1299add6839","repo":"weaviate/weaviate","slug":"unsupported-pq-encoder-type-d","errorCode":null,"errorMessage":"unsupported PQ encoder type %d","messagePattern":"unsupported PQ encoder type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/vector/hnsw/compact/snapshot_reader.go","lineNumber":351,"sourceCode":"\n\tpqData := &compression.PQData{\n\t\tDimensions:          dims,\n\t\tEncoderType:         compression.Encoder(encoderType),\n\t\tKs:                  ks,\n\t\tM:                   m,\n\t\tEncoderDistribution: dist,\n\t\tUseBitsEncoding:     useBitsEncoding != 0,\n\t}\n\n\t// Read encoders\n\tvar encoderReader func(io.Reader, *compression.PQData, uint16) (compression.PQSegmentEncoder, error)\n\tswitch pqData.EncoderType {\n\tcase compression.UseTileEncoder:\n\t\tencoderReader = readSnapshotTileEncoder\n\tcase compression.UseKMeansEncoder:\n\t\tencoderReader = readSnapshotKMeansEncoder\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported PQ encoder type %d\", encoderType)\n\t}\n\n\tfor i := uint16(0); i < m; i++ {\n\t\tencoder, err := encoderReader(reader, pqData, i)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"read PQ encoder %d\", i)\n\t\t}\n\t\tpqData.Encoders = append(pqData.Encoders, encoder)\n\t}\n\n\tres.SetCompressionPQData(pqData)\n\treturn nil\n}\n\n// readSnapshotTileEncoder reads a tile encoder from the snapshot.\nfunc readSnapshotTileEncoder(reader io.Reader, data *compression.PQData, i uint16) (compression.PQSegmentEncoder, error) {\n\tbins, err := readSnapshotFloat64(reader)\n\tif err != nil {","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/vector/hnsw/compact/snapshot_reader.go#L333-L369","documentation":"Inside PQ (product quantization) snapshot data, readPQData dispatches on the encoder type stored per-compressor. Only the tile encoder and KMeans encoder are supported; any other value cannot be deserialized and aborts the read.","triggerScenarios":"SnapshotReader.Read on a compressed snapshot whose PQ section encodes an encoder-type byte other than UseTileEncoder or UseKMeansEncoder — from a newer writer version, a corrupted (checksum-passing but semantically wrong) metadata blob, or a test fixture with a bogus value.","commonSituations":"Downgrade across releases that added a new PQ encoder type; or replaying a snapshot produced on another cluster with an incompatible build.","solutions":["Upgrade to the Weaviate version that wrote the snapshot so the new encoder type is understood.","Delete the snapshot and let the PQ-compressed index regenerate from the commitlog.","Recreate the collection/compression configuration so a supported encoder (tile or KMeans) is used, then rebuild the index."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before loading PQ snapshots, confirm the encoder type in the collection config\n// is one supported by this build (tile or KMeans):\n// if cfg.PQ.Encoder.Type not in {tile, kmeans} -> rebuild instead of loading","typeGuard":"func isSupportedPQEncoder(e uint8) bool {\n\treturn e == compression.UseTileEncoder || e == compression.UseKMeansEncoder\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unsupported PQ encoder type\") {\n\treturn fmt.Errorf(\"snapshot PQ encoder unknown to this build; upgrade or re-compress index: %w\", err)\n}","preventionTips":["Avoid downgrading Weaviate on collections using PQ compression.","Standardize PQ encoder settings (tile/kmeans) across environments.","Rebuild the index from vectors if a snapshot's encoder is unrecognized."],"tags":["hnsw","snapshot","pq","compression","versioning"],"backgroundTag":"unsupported-file-format-version","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"}