{"record":{"id":"87af7f7ffd3045f0","repo":"apache/cassandra","slug":"missing-index-component","errorCode":null,"errorMessage":"Missing index component","messagePattern":"Missing index component","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/io/sstable/format/bti/BtiTableScrubber.java","lineNumber":61,"sourceCode":"{\n    private final boolean isIndex;\n    private final AbstractType<?> partitionKeyType;\n    private ScrubPartitionIterator indexIterator;\n\n    public BtiTableScrubber(ColumnFamilyStore cfs,\n                            LifecycleTransaction transaction,\n                            OutputHandler outputHandler,\n                            IScrubber.Options options)\n    {\n        super(cfs, transaction, outputHandler, options);\n\n        boolean hasIndexFile = sstable.getComponents().contains(Components.PARTITION_INDEX);\n        this.isIndex = cfs.isIndex();\n        this.partitionKeyType = cfs.metadata.get().partitionKeyType;\n        if (!hasIndexFile)\n        {\n            // if there's any corruption in the -Data.db then partitions can't be skipped over. but it's worth a shot.\n            outputHandler.warn(\"Missing index component\");\n        }\n\n        try\n        {\n            this.indexIterator = hasIndexFile\n                                 ? openIndexIterator()\n                                 : null;\n        }\n        catch (RuntimeException ex)\n        {\n            outputHandler.warn(\"Detected corruption in the index file - cannot open index iterator\", ex);\n        }\n    }\n\n    private ScrubPartitionIterator openIndexIterator()\n    {\n        try\n        {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/bti/BtiTableScrubber.java#L43-L79","documentation":"When constructing a BTI-format scrubber, the sstable's PARTITION_INDEX component is absent. The scrubber warns 'Missing index component' and scrubs without the partition index, losing the ability to validate or skip partitions using index positions.","triggerScenarios":"BtiTableScrubber constructor: sstable.getComponents().contains(Components.PARTITION_INDEX) is false — the -PartitionIndex.db file is missing from the sstable's files on disk.","commonSituations":"Incomplete restores/backups, manual deletion of index files, moving sstables between nodes with missing components, failed writes leaving partial sstables.","solutions":["Restore the -PartitionIndex.db from a snapshot or stream the sstable from a replica","Run `nodetool repair` so a healthy replica replaces the sstable","Proceed with scrub knowing partitions cannot be index-validated (corrupt partitions can't be skipped)","Rebuild the node if many sstables lack components"],"exampleFix":"// before: scrubbing BTI sstable without partition index\noutputHandler.warn(\"Missing index component\");\n// after: pre-flight component check\nif (!sstable.getComponents().contains(Components.PARTITION_INDEX))\n    throw new IllegalStateException(\"Restore PARTITION_INDEX before scrubbing \" + sstable);","handlingStrategy":"validation","validationCode":"Set<Component> comps = sstable.getComponents();\nif (!comps.contains(Components.PARTITION_INDEX))\n    throw new IllegalStateException(sstable + \" lacks PARTITION_INDEX; restore from snapshot/replica before scrub\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy sstables as whole directory sets (all components)","Use `nodetool snapshot`/restore flows instead of ad-hoc file moves","Run `nodetool verify` before scrub to catch missing components","Never manually prune sstable files on disk"],"tags":["cassandra","bti","sstable","missing-component"],"backgroundTag":"file-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}