apache/cassandra · error · RuntimeException

Directory %s does not exist

Error message

Directory %s does not exist

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/db/SSTableImporter.java:325

    }

    /**
     * Create SSTableListers based on srcPaths
     *
     * If srcPaths is empty, we create a lister that lists sstables in the data directories (deprecated use)
     */
    private List<Pair<Directories.SSTableLister, String>> getSSTableListers(Set<String> srcPaths)
    {
        List<Pair<Directories.SSTableLister, String>> listers = new ArrayList<>();

        if (!srcPaths.isEmpty())
        {
            for (String path : srcPaths)
            {
                File dir = new File(path);
                if (!dir.exists())
                {
                    throw new RuntimeException(String.format("Directory %s does not exist", path));
                }
                if (!Directories.verifyFullPermissions(dir, path))
                {
                    throw new RuntimeException("Insufficient permissions on directory " + path);
                }
                listers.add(Pair.create(cfs.getDirectories().sstableLister(dir, Directories.OnTxnErr.IGNORE).skipTemporary(true), path));
            }
        }
        else
        {
            listers.add(Pair.create(cfs.getDirectories().sstableLister(Directories.OnTxnErr.IGNORE).skipTemporary(true), null));
        }

        return listers;
    }

    private static class MovedSSTable
    {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Verify the path exists on the Cassandra node (not the client) with `ls <path>` and fix the typo/path passed to the import command
  2. Recreate the missing directory or move the sstables into an existing directory before importing
  3. Check filesystem mounts (df/mount) if the path lives on a separate volume
  4. Run nodetool import again with the corrected absolute path

Example fix

// before
nodetool import -- keyspace table /mnt/staging/sstables
// after
ls /mnt/staging/sstables  # confirm path exists on the node first
nodetool import -- keyspace table /mnt/staging/sstables
Defensive patterns

Strategy: validation

Validate before calling

File dir = new File(path);
if (!dir.exists()) throw new IllegalArgumentException("Directory does not exist: " + path);
if (!dir.isDirectory()) throw new IllegalArgumentException("Not a directory: " + path);

Type guard

boolean isExistingDirectory(String p) { File d = new File(p); return d.exists() && d.isDirectory(); }

Try / catch

try { importer.importNewSSTables(...); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().contains("does not exist")) { /* fix path and retry */ } else throw e; }

Prevention

When it happens

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

Common situations: 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.

Related errors


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