apache/cassandra · error

Directory {} doesn't exist

Error message

Directory {} doesn't exist

What it means

checkDataDirs verifies at startup that every data file directory from cassandra.yaml exists. If a directory is missing it is logged as a warning and auto-created; if creation fails (typically due to filesystem permissions), a StartupException with ERR_WRONG_DISK_STATE is thrown and the node refuses to start.

Source

Thrown at src/java/org/apache/cassandra/service/StartupChecks.java:857

        @Override
        public void execute(StartupChecksConfiguration configuration) throws StartupException
        {
            if (configuration.isDisabled(name()))
                return;
            // check all directories(data, commitlog, saved cache) for existence and permission
            Iterable<String> dirs = Iterables.concat(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()),
                                                     Arrays.asList(DatabaseDescriptor.getCommitLogLocation(),
                                                                   DatabaseDescriptor.getSavedCachesLocation(),
                                                                   DatabaseDescriptor.getHintsDirectory().absolutePath()));
            for (String dataDir : dirs)
            {
                logger.debug("Checking directory {}", dataDir);
                File dir = new File(dataDir);

                // check that directories exist.
                if (!dir.exists())
                {
                    logger.warn("Directory {} doesn't exist", dataDir);
                    // if they don't, failing their creation, stop cassandra.
                    if (!dir.tryCreateDirectories())
                        throw new StartupException(StartupException.ERR_WRONG_DISK_STATE,
                                                   "Has no permission to create directory "+ dataDir);
                }

                // if directories exist verify their permissions
                if (!Directories.verifyFullPermissions(dir, dataDir))
                    throw new StartupException(StartupException.ERR_WRONG_DISK_STATE,
                                               "Insufficient permissions on directory " + dataDir);
            }
        }
    };

    public static final StartupCheck checkDirectIOSupport = new StartupCheck()
    {
        @Override
        public String name()

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Create the missing directory and chown it to the Cassandra user: mkdir -p <dir> && chown -R cassandra:cassandra <dir>
  2. Verify the path in cassandra.yaml data_file_directories is correct and the volume is mounted before startup
  3. Check filesystem permissions/mount options (read-only mounts, SELinux) preventing creation
  4. If the directory is intentionally gone, remove the stale entry from cassandra.yaml

Example fix

// before (cassandra.yaml)
data_file_directories:
  - /var/lib/cassandra/data   # volume not mounted

// after (shell pre-check before starting Cassandra)
$ mkdir -p /var/lib/cassandra/data
$ chown -R cassandra:cassandra /var/lib/cassandra
$ df -h /var/lib/cassandra  # confirm mount exists
Defensive patterns

Strategy: validation

Validate before calling

for (String dir : dataFileDirectories) {
    File d = new File(dir);
    if (!d.exists() && !d.getParentFile().canWrite())
        throw new IllegalStateException("Cannot create data dir " + dir + ": no write permission on parent");
}

Try / catch

try {
    startCassandra();
} catch (StartupException e) {
    if (e.errorCode == StartupException.ERR_WRONG_DISK_STATE)
        // fix directory/permission and retry bootstrap
        provisionDataDirs();
}

Prevention

When it happens

Trigger: A data_file_directories entry in cassandra.yaml points to a path that does not exist and the process user lacks write permission on the parent (dir.tryCreateDirectories() returns false), throwing StartupException(ERR_WRONG_DISK_STATE).

Common situations: Typo in data_file_directories path; volume not mounted before Cassandra starts (Kubernetes StatefulSet ordering); changed ownership of /var/lib/cassandra; running as non-cassandra user for testing.

Related errors


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