apache/cassandra · error · RuntimeException

Error while loading snapshots from

Error message

Error while loading snapshots from %s

What it means

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.

Solutions

  1. Check the wrapped cause ('Caused by' IOException) to identify the failing dataDir and address the underlying I/O or permission issue.
  2. Verify read+execute permissions on the data directories and snapshot subdirectories for the Cassandra user.
  3. Check disk health (dmesg / fsck) if the error recurs on a local volume; remount network filesystems.
  4. Restart the node if 'too many open files' is the cause and raise the ulimit.

Example fix

// before
new File(dataDir).setReadable(false);
// after
Files.setPosixFilePermissions(dataDirPath, PosixFilePermissions.fromString("rwxr-x---"));
Defensive patterns

Strategy: try-catch

Validate before calling

for (Path d : dataDirs) { if (!Files.isDirectory(d) || !Files.isReadable(d)) throw new IllegalStateException("Unreadable data dir: " + d); }

Try / catch

try { loader.loadSnapshots(); } catch (RuntimeException e) { log.error("Snapshot load failed on {}", e.getCause() != null ? e.getCause().toString() : "unknown", e); }

Prevention

When it happens

Trigger: 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.

Common situations: Snapshots stored on flaky network mounts; read permissions lost after restore; disk full/hardware error during a JMX snapshot listing call.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/9fa0e7cfec2713ac. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/service/snapshot/SnapshotLoader.java:227

        Map<String, TableSnapshot.Builder> snapshots = new HashMap<>();
        Visitor visitor = new Visitor(snapshots);

        for (Path dataDir : dataDirectories)
        {
            if (keyspace != null)
                dataDir = dataDir.resolve(keyspace);

            try
            {
                if (new File(dataDir).exists())
                    Files.walkFileTree(dataDir, Collections.emptySet(), maxDepth, visitor);
                else
                    logger.debug("Skipping non-existing data directory {}", dataDir);
            }
            catch (IOException e)
            {
                throw new RuntimeException(String.format("Error while loading snapshots from %s", dataDir), e);
            }
        }

        Set<TableSnapshot> tableSnapshots = new HashSet<>();
        for (TableSnapshot.Builder snapshotBuilder : snapshots.values())
            tableSnapshots.add(snapshotBuilder.build());

        return tableSnapshots;
    }

    public Set<TableSnapshot> loadSnapshots()
    {
        return loadSnapshots(null);
    }
}

View on GitHub (pinned to 88fd0f6a0e)