{"record":{"id":"9fa0e7cfec2713ac","repo":"apache/cassandra","slug":"error-while-loading-snapshots-from-s","errorCode":null,"errorMessage":"Error while loading snapshots from %s","messagePattern":"Error while loading snapshots from (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/snapshot/SnapshotLoader.java","lineNumber":227,"sourceCode":"\n        Map<String, TableSnapshot.Builder> snapshots = new HashMap<>();\n        Visitor visitor = new Visitor(snapshots);\n\n        for (Path dataDir : dataDirectories)\n        {\n            if (keyspace != null)\n                dataDir = dataDir.resolve(keyspace);\n\n            try\n            {\n                if (new File(dataDir).exists())\n                    Files.walkFileTree(dataDir, Collections.emptySet(), maxDepth, visitor);\n                else\n                    logger.debug(\"Skipping non-existing data directory {}\", dataDir);\n            }\n            catch (IOException e)\n            {\n                throw new RuntimeException(String.format(\"Error while loading snapshots from %s\", dataDir), e);\n            }\n        }\n\n        Set<TableSnapshot> tableSnapshots = new HashSet<>();\n        for (TableSnapshot.Builder snapshotBuilder : snapshots.values())\n            tableSnapshots.add(snapshotBuilder.build());\n\n        return tableSnapshots;\n    }\n\n    public Set<TableSnapshot> loadSnapshots()\n    {\n        return loadSnapshots(null);\n    }\n}\n","sourceCodeStart":209,"sourceCodeEnd":243,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/snapshot/SnapshotLoader.java#L209-L243","documentation":"SnapshotLoader.loadSnapshots wraps IOExceptions raised while walking a data directory for snapshot manifests in a RuntimeException. It indicates a filesystem-level failure (unreadable directory, I/O error) while discovering snapshots, not a problem with snapshot content itself.","triggerScenarios":"Files.walkFileTree on a data dir throws IOException: directory removed mid-scan, NFS/disk error, permission denied on traversal, or too many open files while iterating many snapshot dirs.","commonSituations":"Snapshots stored on flaky network mounts; read permissions lost after restore; disk full/hardware error during a JMX snapshot listing call.","solutions":["Check the wrapped cause ('Caused by' IOException) to identify the failing dataDir and address the underlying I/O or permission issue.","Verify read+execute permissions on the data directories and snapshot subdirectories for the Cassandra user.","Check disk health (dmesg / fsck) if the error recurs on a local volume; remount network filesystems.","Restart the node if 'too many open files' is the cause and raise the ulimit."],"exampleFix":"// before\nnew File(dataDir).setReadable(false);\n// after\nFiles.setPosixFilePermissions(dataDirPath, PosixFilePermissions.fromString(\"rwxr-x---\"));","handlingStrategy":"try-catch","validationCode":"for (Path d : dataDirs) { if (!Files.isDirectory(d) || !Files.isReadable(d)) throw new IllegalStateException(\"Unreadable data dir: \" + d); }","typeGuard":null,"tryCatchPattern":"try { loader.loadSnapshots(); } catch (RuntimeException e) { log.error(\"Snapshot load failed on {}\", e.getCause() != null ? e.getCause().toString() : \"unknown\", e); }","preventionTips":["Keep snapshot dirs on local/reliable storage where possible","Ensure cassandra user has read+execute on all data dirs","Raise nofile ulimit on snapshot-heavy nodes","Monitor disk health"],"tags":["snapshot","io","filesystem","runtimeexception"],"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"}