{"record":{"id":"5ad473e9c8aac115","repo":"apache/cassandra","slug":"at-least-one-datafiledirectory-must-be-specified","errorCode":null,"errorMessage":"At least one DataFileDirectory must be specified","messagePattern":"At least one DataFileDirectory must be specified","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":2409,"sourceCode":"    {\n        return conf.max_value_size.toBytes();\n    }\n\n    public static void setMaxValueSize(int maxValueSizeInBytes)\n    {\n        // the below division is safe as this setter is used only in tests with values that won't lead to precision loss\n        conf.max_value_size = new DataStorageSpec.IntMebibytesBound((maxValueSizeInBytes / (1024L * 1024)), MEBIBYTES);\n    }\n\n    /**\n     * Creates all storage-related directories.\n     */\n    public static void createAllDirectories()\n    {\n        try\n        {\n            if (conf.data_file_directories.length == 0)\n                throw new ConfigurationException(\"At least one DataFileDirectory must be specified\", false);\n\n            for (String dataFileDirectory : conf.data_file_directories)\n                FileUtils.createDirectory(dataFileDirectory);\n\n            if (conf.local_system_data_file_directory != null)\n                FileUtils.createDirectory(conf.local_system_data_file_directory);\n\n            if (conf.commitlog_directory == null)\n                throw new ConfigurationException(\"commitlog_directory must be specified\", false);\n            FileUtils.createDirectory(conf.commitlog_directory);\n\n            if (conf.accord.journal_directory == null)\n                throw new ConfigurationException(\"accord.journal_directory must be specified\", false);\n            FileUtils.createDirectory(conf.accord.journal_directory);\n\n            if (conf.hints_directory == null)\n                throw new ConfigurationException(\"hints_directory must be specified\", false);\n            FileUtils.createDirectory(conf.hints_directory);","sourceCodeStart":2391,"sourceCodeEnd":2427,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L2391-L2427","documentation":"During createAllDirectories, DatabaseDescriptor requires conf.data_file_directories to be non-empty before creating each directory; a missing value means Cassandra has nowhere to place SSTables, so it throws this ConfigurationException (non-logged variant). This is one of the mandatory-directory checks at the start of node initialization.","triggerScenarios":"Starting Cassandra with a cassandra.yaml that omits data_file_directories entirely, or a programmatic Config object (tests/Dtest) where the data file locations array is empty when createAllDirectories is called.","commonSituations":"Empty or malformed cassandra.yaml (properties stripped, wrong config file loaded via cassandra.config); programmatic setup that initializes DatabaseDescriptor before setting data_file_directories; overwritten cassandra.yaml during upgrade.","solutions":["Set data_file_directories in cassandra.yaml to one or more existing/writable paths","Ensure the cassandra.config system property points at the intended yaml file","In programmatic use, set the data file locations on the Config before createAllDirectories"],"exampleFix":"// before (cassandra.yaml)\n# data_file_directories not set\n// after\ndata_file_directories:\n  - /var/lib/cassandra/data","handlingStrategy":"try-catch","validationCode":"if (conf.data_file_directories == null || conf.data_file_directories.length == 0)\n    throw new IllegalArgumentException(\"data_file_directories must be set in cassandra.yaml\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.daemonInitialization(); }\ncatch (ConfigurationException e) {\n    if (e.getMessage().contains(\"DataFileDirectory\"))\n        abortStartupWithConfigHint();\n}","preventionTips":["Lint cassandra.yaml against the required-keys list in CI","Never hand-trim mandatory keys from config templates","Use the packaged cassandra.yaml as the base and only edit values"],"tags":["configuration","cassandra-yaml","directories"],"backgroundTag":"missing-required-config-field","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}