{"record":{"id":"41e22c80b84a96de","repo":"apache/cassandra","slug":"error-reading-key-s-s","errorCode":null,"errorMessage":"Error reading key %s: %s","messagePattern":"Error reading key (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/StandaloneJournalUtil.java","lineNumber":352,"sourceCode":"                boolean shouldSkip = false;\n\n                if (skipAllErrors)\n                {\n                    shouldSkip = true;\n                }\n                else if (!skipExceptionTypes.isEmpty())\n                {\n                    String exceptionClassName = t.getClass().getSimpleName();\n                    String fullExceptionClassName = t.getClass().getName();\n\n                    shouldSkip = skipExceptionTypes.contains(exceptionClassName) ||\n                                 skipExceptionTypes.contains(fullExceptionClassName);\n                }\n\n                if (!shouldSkip)\n                    throw t;\n\n                throw new RuntimeException(String.format(\"Error reading key %s: %s\", key, t.getMessage()), t);\n            }\n        }\n    }\n\n    @Command(name = \"load\", description = \"Load item from journal\")\n    public static class Load implements Runnable\n    {\n        @Option(names = {\"-s\", \"--sstables\"}, description = \"Path to sstables\")\n        public String sstables;\n\n        @Option(names = {\"-j\", \"--journal-segments\"}, description = \"Path to journal segments\")\n        public String journalSegments;\n\n        @Option(names = {\"-k\", \"--kind\"}, description = \"Kind to filter by\")\n        public String kind;\n\n        @Option(names = {\"-c\", \"--command-store-id\"}, description = \"Command Store id\")\n        public String commandStoreId;","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/StandaloneJournalUtil.java#L334-L370","documentation":"While processing a key read from an SSTable or journal segment, an unexpected Throwable was caught. The code only wraps it in a RuntimeException with context when the exception type is in the skip-exception list; otherwise the original is rethrown. The wrapper message names the key that failed and preserves the cause.","triggerScenarios":"A deserialization or read failure occurs for a specific key during a standalone journal tool run and the exception's class is listed in --skip-exception-types (or the configured skip set), so instead of propagating the raw error the tool wraps it with 'Error reading key %s: %s'.","commonSituations":"Corrupt SSTable data or journal segments after a crash; reading files with a different Cassandra version than wrote them; deserializer incompatibilities on partially written files.","solutions":["Inspect the cause chain of the RuntimeException to find the underlying read/deserialization failure","Run with --skip-exception-types to tolerate the failing exception class if the corruption is acceptable","Restore the affected SSTable/journal segment from a backup or snapshot","Run scrub/verify on the affected SSTables to repair corruption"],"exampleFix":"// before\nthrow t; // raw failure aborts the whole run\n// after\n// configure the tool to skip known-benign failure types\n--skip-exception-types java.io.IOException","handlingStrategy":"try-catch","validationCode":"// Before running: check sstable/segment files exist and are readable\nFiles.isReadable(Paths.get(desc.filenameFor(Component.DATA)))","typeGuard":null,"tryCatchPattern":"try { tool.run(); }\ncatch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Error reading key \")) {\n        Throwable cause = e.getCause(); // inspect real read failure\n        log(\"key read failed for \" + key + \": \" + cause);\n    } else throw e;\n}","preventionTips":["Run scrub/verify after unclean shutdowns before journal tools","Keep Cassandra versions consistent between writer and reader of the files","Take a snapshot before offline tool runs so data can be restored"],"tags":["corruption","deserialization","offline-tools"],"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-17T15:17:12.973Z"}