{"record":{"id":"416c5bb6d9802deb","repo":"apache/cassandra","slug":"is-corrupt-can-t-import","errorCode":null,"errorMessage":" is corrupt, can't import","messagePattern":" is corrupt, can't import","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java","lineNumber":1915,"sourceCode":"                logger.warn(\"Unable to hardlink new SSTable {} to {}, falling back to copying\", oldDescriptor, newDescriptor, ex);\n                copy(oldDescriptor, newDescriptor, components);\n            }\n        }\n        else\n        {\n            logger.info(\"Moving new SSTable {} to {}\", oldDescriptor, newDescriptor);\n            rename(oldDescriptor, newDescriptor, components);\n        }\n\n        SSTableReader reader;\n        try\n        {\n            reader = open(cfs, newDescriptor, components, cfs.metadata);\n        }\n        catch (Throwable t)\n        {\n            logger.error(\"Aborting import of sstables. {} was corrupt\", newDescriptor);\n            throw new RuntimeException(newDescriptor + \" is corrupt, can't import\", t);\n        }\n        return reader;\n    }\n\n    public static void shutdownBlocking(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException\n    {\n\n        ExecutorUtils.shutdownNowAndWait(timeout, unit, syncExecutor);\n        resetTidying();\n    }\n\n    /**\n     * @return the physical size on disk of all components for this SSTable in bytes\n     */\n    public long bytesOnDisk()\n    {\n        return bytesOnDisk(false);\n    }","sourceCodeStart":1897,"sourceCodeEnd":1933,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java#L1897-L1933","documentation":"After moving an SSTable, moveAndOpenSSTable() attempts open() on the new descriptor; if opening fails with any Throwable it logs that the descriptor was corrupt and rethrows a RuntimeException with '<descriptor> is corrupt, can't import' as the message and the original failure as the cause, aborting the import.","triggerScenarios":"open() throwing while reading the moved SSTable's components (missing/invalid Summary, Statistics, TOC, or Data file; checksum failures; wrong partitioner metadata) during an sstable import operation.","commonSituations":"Importing truncated or partially copied SSTables; files damaged during transfer between nodes; SSTables copied with missing secondary components; restoring incomplete backups.","solutions":["Inspect the cause exception (sstablemetadata on the file) to identify the corrupt component","Re-copy the SSTable set completely (all components) from the source and retry the import","Use sstableloader instead of direct import; it validates and streams correctly","Run nodetool repair to restore data from other replicas and then remove the corrupt files"],"exampleFix":"// before: copying only the Data file\nscp node:/data/ks/tbl/xx-big-Data.db /data/ks/tbl/\n// after: copy all components\nscp 'node:/data/ks/tbl/xx-big-*' /data/ks/tbl/","handlingStrategy":"validation","validationCode":"// validate the sstable before import\nsstablemetadata <newDesc>/xx-big-Statistics.db\nsstableverify or SortedTableVerifier.verify() before open","typeGuard":null,"tryCatchPattern":"try { reader = SSTableReader.moveAndOpenSSTable(cfs, oldDesc, newDesc, comps, false); }\ncatch (RuntimeException e) {\n    if (e.getMessage().endsWith(\"is corrupt, can't import\")) {\n        logger.error(\"Corrupt sstable {}, cause: {}\", newDesc, e.getCause());\n        reCopyAllComponentsAndRetry();\n    } else throw e;\n}","preventionTips":["Copy ALL SSTable components, never just the Data file","Validate files (checksums) after transfer between nodes","Use sstableloader for cross-node data movement","Verify backups restore completely before relying on them"],"tags":["sstable","corruption","import"],"backgroundTag":"checksum-mismatch","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"}