{"record":{"id":"a67eabc35aed7fd2","repo":"apache/cassandra","slug":"unable-check-disk-space-in-s-perhaps-the-cassa","errorCode":null,"errorMessage":"Unable check disk space in '%s'. Perhaps the Cassandra user does not have the necessary permissions","messagePattern":"Unable check disk space in '(.+?)'\\. Perhaps the Cassandra user does not have the necessary permissions","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":2038,"sourceCode":"\n    /**\n     * Computes the sum of the 2 specified positive values returning {@code Long.MAX_VALUE} if the sum overflow.\n     *\n     * @param left  the left operand\n     * @param right the right operand\n     * @return the sum of the 2 specified positive values of {@code Long.MAX_VALUE} if the sum overflow.\n     */\n    private static long saturatedSum(long left, long right)\n    {\n        assert left >= 0 && right >= 0;\n        long sum = left + right;\n        return sum < 0 ? Long.MAX_VALUE : sum;\n    }\n\n    private static long tryGetSpace(String dir, PathUtils.IOToLongFunction<FileStore> getSpace)\n    {\n        return PathUtils.tryGetSpace(new File(dir).toPath(), getSpace, e -> {\n            throw new ConfigurationException(\"Unable check disk space in '\" + dir + \"'. Perhaps the Cassandra user does not have the necessary permissions\");\n        });\n    }\n\n    public static IEndpointSnitch createEndpointSnitch(String snitchClassName) throws ConfigurationException\n    {\n        if (!snitchClassName.contains(\".\"))\n            snitchClassName = \"org.apache.cassandra.locator.\" + snitchClassName;\n        IEndpointSnitch snitch = FBUtilities.construct(snitchClassName, \"snitch\", IEndpointSnitch.class);\n        return snitch;\n    }\n\n    public static NodeProximity createProximityImpl(String className) throws ConfigurationException\n    {\n        if (!className.contains(\".\"))\n            className = \"org.apache.cassandra.locator.\" + className;\n        NodeProximity sorter = FBUtilities.construct(className, \"node proximity measurement\", NodeProximity.class);\n        return sorter;\n    }","sourceCodeStart":2020,"sourceCodeEnd":2056,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L2020-L2056","documentation":"tryGetSpace asks the filesystem for a directory's space via PathUtils.tryGetSpace using a FileStore query; if the query throws IOException, the lambda converts it into this ConfigurationException. Cassandra needs disk-usage figures at startup to enforce space thresholds, so an unreadable data/commitlog directory aborts initialization.","triggerScenarios":"Calling a DatabaseDescriptor space check (e.g. getTotalFilespace / disk-usage validation over data_file_directories or commitlog_directory) where the FileStore query on the directory path fails due to permissions, an unmounted volume, or an IO error.","commonSituations":"cassandra.yaml points data_file_directories/commitlog_directory at a path the cassandra OS user cannot read; NFS/automount not mounted at boot; directory removed after config parse but before the space check; containers with restricted volume permissions.","solutions":["Fix filesystem permissions so the Cassandra user can stat/read the directory (chown/chmod)","Verify the volume is actually mounted at the configured path before starting Cassandra","Correct the directory path in cassandra.yaml to an existing, accessible location"],"exampleFix":"// before\nchown root:root /var/lib/cassandra\n// after\nchown -R cassandra:cassandra /var/lib/cassandra","handlingStrategy":"try-catch","validationCode":"for (String dir : allConfiguredDirectories)\n    if (!Files.isReadable(Paths.get(dir)))\n        throw new IllegalStateException(\"Cassandra user cannot read \" + dir);","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.daemonInitialization(); }\ncatch (ConfigurationException e) {\n    if (e.getMessage().startsWith(\"Unable check disk space\"))\n        repairMountAndPermissions();\n}","preventionTips":["Run Cassandra as a user with read access on all configured directories","Verify mounts (data/commitlog volumes) before service start in systemd/container entrypoints","Monitor for unmounted volumes at boot"],"tags":["filesystem","permissions","startup"],"backgroundTag":"permission-denied","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"}