{"record":{"id":"187c46dae58eafac","repo":"apache/cassandra","slug":"is-missing-and-cassandra-storagedir-system-proper","errorCode":null,"errorMessage":" is missing and cassandra.storagedir system property is not set","messagePattern":" is missing and cassandra\\.storagedir system property is not set","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":1471,"sourceCode":"            StartupChecks startupChecks = new StartupChecks().withDefaultTests().withTest(new FileSystemOwnershipCheck()).withServiceLoaderTests();\n            startupChecksConfiguration = new StartupChecksConfiguration(startupChecks, conf.startup_checks);\n        }\n        catch (Throwable t)\n        {\n            throw new ConfigurationException(\"Invalid configuration of startup_checks: \" + t.getMessage());\n        }\n    }\n\n    private static String storagedirFor(String type)\n    {\n        return storagedir(type + \"_directory\") + File.pathSeparator() + type;\n    }\n\n    private static String storagedir(String errMsgType)\n    {\n        String storagedir = STORAGE_DIR.getString();\n        if (storagedir == null)\n            throw new ConfigurationException(errMsgType + \" is missing and \" + STORAGE_DIR.getKey() + \" system property is not set\", false);\n        return storagedir;\n    }\n\n    static int calculateDefaultSpaceInMiB(String type, String path, String setting, int preferredSizeInMiB, long totalSpaceInBytes, long totalSpaceNumerator, long totalSpaceDenominator)\n    {\n        final long totalSizeInMiB = totalSpaceInBytes / ONE_MIB;\n        final int minSizeInMiB = Ints.saturatedCast(totalSpaceNumerator * totalSizeInMiB / totalSpaceDenominator);\n\n        if (minSizeInMiB < preferredSizeInMiB)\n        {\n            logger.warn(\"Small {} volume detected at '{}'; setting {} to {}.  You can override this in cassandra.yaml\",\n                        type, path, setting, minSizeInMiB);\n            return minSizeInMiB;\n        }\n        else\n        {\n            return preferredSizeInMiB;\n        }","sourceCodeStart":1453,"sourceCodeEnd":1489,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1453-L1489","documentation":"DatabaseDescriptor.storagedir() resolves the storage directory from the cassandra.storagedir system property (STORAGE_DIR). When it is not set, every storagedirFor() caller (commitlog_directory, saved_caches_directory, data_file_directories, etc.) throws this ConfigurationException. The message is prefixed with the specific directory type that is missing.","triggerScenarios":"Neither the relevant *_directory setting in cassandra.yaml nor the cassandra.storagedir system property is set, and code calls storagedirFor(\"commitlog\") (or data/saved_caches/hints) to derive a path.","commonSituations":"Running Cassandra with a minimal cassandra.yaml that omits directories while expecting the storagedir property to be set; launching via a script that does not pass -Dcassandra.storagedir; Docker/containers where the entrypoint forgets to export the system property.","solutions":["Start Cassandra with -Dcassandra.storagedir=/var/lib/cassandra (or set CASSANDRA_OPTS in cassandra-env.sh).","Alternatively set the explicit directory settings in cassandra.yaml (data_file_directories, commitlog_directory, saved_caches_directory, hints_directory).","Ensure directories exist and are writable by the cassandra user."],"exampleFix":"// before\ncassandra-env.sh: JVM_OPTS=\"$JVM_OPTS\"\n// after\ncassandra-env.sh: JVM_OPTS=\"$JVM_OPTS -Dcassandra.storagedir=/var/lib/cassandra\"","handlingStrategy":"validation","validationCode":"// fail fast in launcher scripts before starting the JVM\nif [ -z \"$CASSANDRA_STORAGEDIR\" ] && ! grep -qE '(data_file_directories|commitlog_directory):' conf/cassandra.yaml; then\n  echo \"Set -Dcassandra.storagedir or directory settings in cassandra.yaml\" >&2; exit 1;\nfi","typeGuard":null,"tryCatchPattern":"catch (ConfigurationException e) { logger.error(\"Storage directory not configured: {}\", e.getMessage()); System.exit(2); }","preventionTips":["Always export -Dcassandra.storagedir in cassandra-env.sh / container entrypoints","Explicitly set data_file_directories and commitlog_directory in every environment's yaml","Add a pre-start smoke config validation step"],"tags":["configuration","filesystem","storage-directory","cassandra"],"backgroundTag":"missing-env-var","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"}