{"record":{"id":"bd18cf7fabf2a180","repo":"apache/cassandra","slug":"data-file-directories-must-not-contain-empty-entry","errorCode":null,"errorMessage":"data_file_directories must not contain empty entry","messagePattern":"data_file_directories must not contain empty entry","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":885,"sourceCode":"\n            logger.info(\"cdc_enabled is true. Starting casssandra node with Change-Data-Capture enabled.\");\n        }\n\n        if (conf.saved_caches_directory == null)\n        {\n            conf.saved_caches_directory = storagedirFor(\"saved_caches\");\n        }\n        if (conf.data_file_directories == null || conf.data_file_directories.length == 0)\n        {\n            conf.data_file_directories = new String[]{ storagedir(\"data_file_directories\") + File.pathSeparator() + \"data\" };\n        }\n\n        long dataFreeBytes = 0;\n        /* data file and commit log directories. they get created later, when they're needed. */\n        for (String datadir : conf.data_file_directories)\n        {\n            if (datadir == null)\n                throw new ConfigurationException(\"data_file_directories must not contain empty entry\", false);\n            if (datadir.equals(conf.local_system_data_file_directory))\n                throw new ConfigurationException(\"local_system_data_file_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.commitlog_directory))\n                throw new ConfigurationException(\"commitlog_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.accord.journal_directory))\n                throw new ConfigurationException(\"accord.journal_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.hints_directory))\n                throw new ConfigurationException(\"hints_directory must not be the same as any data_file_directories\", false);\n            if (datadir.equals(conf.saved_caches_directory))\n                throw new ConfigurationException(\"saved_caches_directory must not be the same as any data_file_directories\", false);\n\n            dataFreeBytes = saturatedSum(dataFreeBytes, tryGetSpace(datadir, FileStore::getUnallocatedSpace));\n        }\n        if (dataFreeBytes < 64 * ONE_GIB) // 64 GB\n            logger.warn(\"Only {} free across all data volumes. Consider adding more capacity to your cluster or removing obsolete snapshots\",\n                        FBUtilities.prettyPrintMemory(dataFreeBytes));\n\n        if (conf.local_system_data_file_directory != null)","sourceCodeStart":867,"sourceCodeEnd":903,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L867-L903","documentation":"During startup, DatabaseDescriptor iterates conf.data_file_directories and rejects any null entry with a ConfigurationException, because data directories are created and used later for storing SSTables. A null/empty entry means a malformed directory list that cannot be safely resolved.","triggerScenarios":"cassandra.yaml data_file_directories list containing a null/empty element (e.g. 'data_file_directories: [/var/lib/cassandra/data, ,]' or a YAML structure yielding null items); validated in applySimpleConfig at every startup.","commonSituations":"YAML formatting mistakes (trailing commas, mis-indented list items); templating tools (Ansible/Helm) rendering an empty variable into the list; env-var substitution producing empty strings in generated configs.","solutions":["Remove the empty/null entry from data_file_directories in cassandra.yaml","Fix the template/config-generation so the directory list contains only non-empty absolute paths","Validate the rendered cassandra.yaml (e.g. with a YAML linter) before deployment"],"exampleFix":"# before (cassandra.yaml)\ndata_file_directories:\n  - /var/lib/cassandra/data\n  -\n# after (cassandra.yaml)\ndata_file_directories:\n  - /var/lib/cassandra/data","handlingStrategy":"validation","validationCode":"List<String> dirs = (List<String>) yaml.get(\"data_file_directories\");\nif (dirs == null || dirs.isEmpty())\n    throw new IllegalArgumentException(\"data_file_directories is required\");\nfor (String d : dirs)\n    if (d == null || d.isBlank())\n        throw new IllegalArgumentException(\"data_file_directories must not contain empty entries\");","typeGuard":"static boolean validDataDirs(List<String> dirs) {\n    return dirs != null && !dirs.isEmpty() && dirs.stream().allMatch(d -> d != null && !d.isBlank());\n}","tryCatchPattern":"try {\n    DatabaseDescriptor.toolInitialization();\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"data_file_directories\"))\n        throw new StartupConfigError(\"fix empty entries in data_file_directories\", e);\n    throw e;\n}","preventionTips":["Lint rendered cassandra.yaml for empty list items","Fail fast in config templating when a directory variable is empty","Keep each directory entry on its own YAML list line with a concrete path"],"tags":["cassandra","configuration","directories","yaml"],"backgroundTag":"empty-required-field","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"}