{"record":{"id":"bff7d7bf554b6204","repo":"apache/cassandra","slug":"no-configured-data-directory-contains-enough-space","errorCode":null,"errorMessage":"No configured data directory contains enough space to write \" + writeSize + \" bytes","messagePattern":"No configured data directory contains enough space to write \" \\+ writeSize \\+ \" bytes","errorType":"exception","errorClass":"FSWriteError","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/Directories.java","lineNumber":367,"sourceCode":"     * Do not use this method in production code.\n     *\n     * @throws FSWriteError if all directories are disallowed.\n     */\n    public File getDirectoryForNewSSTables()\n    {\n        return getWriteableLocationAsFile(-1L);\n    }\n\n    /**\n     * Returns an allowed directory that _currently_ has {@code writeSize} bytes as usable space.\n     *\n     * @throws FSWriteError if all directories are disallowed.\n     */\n    public File getWriteableLocationAsFile(long writeSize)\n    {\n        File location = getLocationForDisk(getWriteableLocation(writeSize));\n        if (location == null)\n            throw new FSWriteError(new IOException(\"No configured data directory contains enough space to write \" + writeSize + \" bytes\"), \"\");\n        return location;\n    }\n\n    /**\n     * Returns a data directory to load the file {@code sourceFile}. If the sourceFile is on same disk partition as any\n     * data directory then use that one as data directory otherwise use {@link #getWriteableLocationAsFile(long)} to\n     * find suitable data directory.\n     *\n     * Also makes sure returned directory is not disallowed.\n     *\n     * @throws FSWriteError if all directories are disallowed.\n     */\n    public File getWriteableLocationToLoadFile(final File sourceFile)\n    {\n        try\n        {\n            final FileStore srcFileStore = Files.getFileStore(sourceFile.toPath());\n            for (final File dataPath : dataPaths)","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/Directories.java#L349-L385","documentation":"Directories.getWriteableLocationAsFile(writeSize) picks a data directory that can hold a write of the given size. If no configured data directory passes the disk-usage policy (has enough free space after writeSize, not blacklisted, not read-only), it throws FSWriteError wrapping an IOException stating no directory contains enough space.","triggerScenarios":"Flushing a memtable, compacting, or writing an SSTable whose estimated size exceeds the free space of every configured data_file_directories location, taking into account disk_usage_percent_warn/fail thresholds and read-only/blacklisted disks.","commonSituations":"Data directories actually full or nearly full (small disk, unbounded growth); all data dirs on one small partition; incorrect data_file_directories config pointing to tiny mounts; disk failures leaving only undersized volumes; large compactions or huge flushes after big writes.","solutions":["Free space on the data directories (delete snapshots via `nodetool clearsnapshot`, run compaction to reclaim space) or add/expand disks.","Move data_file_directories to larger volumes and restart, or rebalance tokens/tables to nodes with space.","Lower disk_usage_percent settings only as a stopgap; verify with `nodetool diskusage` / `df -h`.","Reduce flush/compaction write sizes (smaller compaction strategies, e.g. LCS/STCS tuning) if a single operation is larger than any disk."],"exampleFix":"// cassandra.yaml before\ndata_file_directories: [/var/lib/cassandra/data]\n// after: distribute across larger volumes\ndata_file_directories:\n  - /mnt/disk1/cassandra/data\n  - /mnt/disk2/cassandra/data","handlingStrategy":"validation","validationCode":"long usable = file.getTotalSpace() - file.getUsableSpace();\nif (writeSize > file.getUsableSpace() * (1 - 0.10)) // keep 10% headroom\n    throw new IllegalStateException(\"Insufficient disk space for \" + writeSize);\n","typeGuard":null,"tryCatchPattern":"try {\n    File dir = directories.getWriteableLocationAsFile(writeSize);\n} catch (FSWriteError e) {\n    if (e.getMessage().contains(\"No configured data directory contains enough space\"))\n        clearSnapshotsAndAlert(); // nodetool clearsnapshot, page on-call\n    throw e;\n}\n","preventionTips":["Alert on disk usage well before the fail threshold (e.g. 80%).","Schedule `nodetool clearsnapshot` cleanup; snapshots silently consume space.","Spread data_file_directories across independent large volumes.","Size disks for the largest expected compaction/flush write."],"tags":["disk-space","storage","fswriteerror","configuration"],"backgroundTag":"file-write-failed","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"}