{"record":{"id":"f4350272efbae4c3","repo":"apache/cassandra","slug":"directory-s-does-not-exist","errorCode":null,"errorMessage":"Directory %s does not exist","messagePattern":"Directory (.+?) does not exist","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/SSTableImporter.java","lineNumber":325,"sourceCode":"    }\n\n    /**\n     * Create SSTableListers based on srcPaths\n     *\n     * If srcPaths is empty, we create a lister that lists sstables in the data directories (deprecated use)\n     */\n    private List<Pair<Directories.SSTableLister, String>> getSSTableListers(Set<String> srcPaths)\n    {\n        List<Pair<Directories.SSTableLister, String>> listers = new ArrayList<>();\n\n        if (!srcPaths.isEmpty())\n        {\n            for (String path : srcPaths)\n            {\n                File dir = new File(path);\n                if (!dir.exists())\n                {\n                    throw new RuntimeException(String.format(\"Directory %s does not exist\", path));\n                }\n                if (!Directories.verifyFullPermissions(dir, path))\n                {\n                    throw new RuntimeException(\"Insufficient permissions on directory \" + path);\n                }\n                listers.add(Pair.create(cfs.getDirectories().sstableLister(dir, Directories.OnTxnErr.IGNORE).skipTemporary(true), path));\n            }\n        }\n        else\n        {\n            listers.add(Pair.create(cfs.getDirectories().sstableLister(Directories.OnTxnErr.IGNORE).skipTemporary(true), null));\n        }\n\n        return listers;\n    }\n\n    private static class MovedSSTable\n    {","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/SSTableImporter.java#L307-L343","documentation":"SSTableImporter.getSTableListers wraps each source directory given to an import operation. Before listing sstables it checks that the directory exists; if the path cannot be found it throws a RuntimeException. The importer only operates on directories that actually contain sstables, so a missing path is a hard failure.","triggerScenarios":"Calling SSTableImporter.importNewSSTables (directly or via nodetool import) with a srcPaths entry pointing to a directory that does not exist on disk, e.g. a typo'd path, a path on an unmounted volume, or a directory deleted between validation and import.","commonSituations":"Operators run `nodetool import` with a wrong --sstable-dir value; automated scripts pass a staging directory that was cleaned up; the path lives on a failed/mounted-later volume; relative path resolved differently on the server than the client.","solutions":["Verify the path exists on the Cassandra node (not the client) with `ls <path>` and fix the typo/path passed to the import command","Recreate the missing directory or move the sstables into an existing directory before importing","Check filesystem mounts (df/mount) if the path lives on a separate volume","Run nodetool import again with the corrected absolute path"],"exampleFix":"// before\nnodetool import -- keyspace table /mnt/staging/sstables\n// after\nls /mnt/staging/sstables  # confirm path exists on the node first\nnodetool import -- keyspace table /mnt/staging/sstables","handlingStrategy":"validation","validationCode":"File dir = new File(path);\nif (!dir.exists()) throw new IllegalArgumentException(\"Directory does not exist: \" + path);\nif (!dir.isDirectory()) throw new IllegalArgumentException(\"Not a directory: \" + path);","typeGuard":"boolean isExistingDirectory(String p) { File d = new File(p); return d.exists() && d.isDirectory(); }","tryCatchPattern":"try { importer.importNewSSTables(...); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().contains(\"does not exist\")) { /* fix path and retry */ } else throw e; }","preventionTips":["Always pass absolute paths to nodetool import; resolve them on the server host","Check the staging directory exists in the automation script before invoking import","Monitor volumes holding staging directories for unmount/cleanup jobs"],"tags":["sstable","import","file-not-found","storage"],"backgroundTag":"directory-not-found","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"}