{"record":{"id":"5c9ff7a547aa786d","repo":"apache/cassandra","slug":"postings-list-s-block-is-corrupted-bits-per-val","errorCode":null,"errorMessage":"Postings list #%s block is corrupted. Bits per value should be no more than 64 and is %d.","messagePattern":"Postings list #(.+?) block is corrupted\\. Bits per value should be no more than 64 and is (.+?)\\.","errorType":"exception","errorClass":"CorruptIndexException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sai/disk/v1/postings/PostingsReader.java","lineNumber":358,"sourceCode":"\n    private void readFoRBlock(IndexInput in) throws IOException\n    {\n        if (blockIndex == 0)\n            actualPosting = in.readVLong();\n\n        byte bitsPerValue = in.readByte();\n\n        long currentPosition = in.getFilePointer();\n\n        if (bitsPerValue == 0)\n        {\n            // If bitsPerValue is 0 then all the values in the block are the same\n            currentFoRValues = LongValues.ZEROES;\n            return;\n        }\n        else if (bitsPerValue > 64)\n        {\n            throw new CorruptIndexException(\n            String.format(\"Postings list #%s block is corrupted. Bits per value should be no more than 64 and is %d.\", blockIndex, bitsPerValue), input);\n        }\n        currentFoRValues = DirectReader.getInstance(seekingInput, bitsPerValue, currentPosition);\n    }\n}\n","sourceCodeStart":340,"sourceCodeEnd":364,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/disk/v1/postings/PostingsReader.java#L340-L364","documentation":"PostingsReader.readFoRBlock() reads a block's bits-per-value header; since frames-of-reference encoding packs values into at most 64 bits, any header value > 64 is impossible and signals a corrupted postings block. It throws a Lucene CorruptIndexException referencing the input file. A value of 0 is legal (all values identical).","triggerScenarios":"ReBuffering a postings block whose stored bitsPerValue byte is > 64 — reading misaligned or corrupt block data (e.g. a wrong pointer landed mid-block).","commonSituations":"Disk corruption, truncated/overwritten SAI postings files, or reading a postings block with a stale offset after a partial write during a crash.","solutions":["Rebuild the affected SAI index (rebuild_index or DROP/CREATE INDEX).","Check disk/filesystem health and validate component checksums.","Upgrade Cassandra if this appears after an unclean shutdown, as newer versions harden block validation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { postings.next(); } catch (CorruptIndexException e) { log.error(\"SAI postings block corrupt\", e); scheduleIndexRebuild(index); }","preventionTips":["Monitor filesystem/disk health; corruption of one block implies broader damage.","Rebuild indexes after unclean shutdowns; keep Cassandra patched for write-path fixes."],"tags":["cassandra","sai","index-corruption","postings"],"backgroundTag":"internal-invariant-violation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}