{"record":{"id":"15c0fde77f4eb7b1","repo":"apache/cassandra","slug":"failed-to-import-sstable-filename","errorCode":null,"errorMessage":"Failed to import sstable <filename>","messagePattern":"Failed to import sstable <filename>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/SSTableImporter.java","lineNumber":410,"sourceCode":"    }\n\n    /**\n     * Iterates over all keys in the sstable index and invalidates the row cache\n     */\n    @VisibleForTesting\n    void invalidateCachesForSSTable(SSTableReader reader)\n    {\n        try (KeyIterator iter = reader.keyIterator())\n        {\n            while (iter.hasNext())\n            {\n                DecoratedKey decoratedKey = iter.next();\n                cfs.invalidateCachedPartition(decoratedKey);\n            }\n        }\n        catch (IOException ex)\n        {\n            throw new RuntimeException(\"Failed to import sstable \" + reader.getFilename(), ex);\n        }\n    }\n\n    /**\n     * Verify an sstable for import, throws exception if there is a failure verifying.\n     *\n     * @param verifyTokens to verify that the tokens are owned by the current node\n     * @param verifySSTables to verify the sstables given. If this is false a \"quick\" verification will be run, just deserializing metadata\n     * @param extendedVerify to validate the values in the sstables\n     */\n    private void verifySSTableForImport(Descriptor descriptor, Set<Component> components, boolean verifyTokens, boolean verifySSTables, boolean extendedVerify)\n    {\n        SSTableReader reader = null;\n        try\n        {\n            reader = SSTableReader.open(cfs, descriptor, components, cfs.metadata);\n            IVerifier.Options verifierOptions = IVerifier.options()\n                                                         .extendedVerification(extendedVerify)","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/SSTableImporter.java#L392-L428","documentation":"invalidateCachesForSSTable opens the sstable being imported to read its keys and evict any matching entries from the key cache/row cache. If reading the sstable's keys throws an IOException, it is rethrown as a RuntimeException naming the sstable file. This usually means the sstable is unreadable or corrupt at the point of import.","triggerScenarios":"importNewSSTables calls invalidateCachesForSSTable on an sstable whose data/index file is truncated, unreadable due to permissions, on a failed disk, or otherwise corrupt, causing IOException while iterating decorated keys.","commonSituations":"Importing partially copied sstable sets (missing -Data.db or -Index.db components); sstables from a different Cassandra major version; corrupted transfer (scp/rsync interrupted); failing disk sectors.","solutions":["Verify all required sstable components (-Data.db, -Index.db, -Summary.db, -Digest) are present and fully copied; re-copy the sstable set","Run `nodetool scrub` or use sstableverify on the source files to check integrity; regenerate the sstable via repair/backup if corrupt","Check the cause chain in the stack trace for the underlying IOException (file not found, permission, IO error)","Confirm the sstable comes from a compatible Cassandra version before importing"],"exampleFix":"// before\nnodetool import -- ks tbl /staging   # only ks-tbl-ka-1-Data.db present\n// after\ncp ks-tbl-ka-1-*.db /staging         # copy ALL components, then import\nnodetool import -- ks tbl /staging","handlingStrategy":"try-catch","validationCode":"// verify all components exist before import\nfor (String base : components) {\n    if (!new File(dir, base).exists()) throw new IllegalStateException(\"Missing component: \" + base);\n}","typeGuard":"null","tryCatchPattern":"try { importer.importNewSSTables(...); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to import sstable\")) { log.error(\"Unreadable sstable\", e.getCause()); /* re-copy or scrub */ } else throw e; }","preventionTips":["Copy complete sstable sets atomically (rsync --checksum or staged rename)","Verify digest files after transfer","Keep source and target Cassandra versions compatible for import"],"tags":["sstable","import","corruption","io"],"backgroundTag":"file-read-failed","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"}