nextcloud/all-in-one · error · InvalidSettingConfigurationException

${DataConst::GetDataDirectory()} does not have enough space

Error message

${DataConst::GetDataDirectory()} does not have enough space for writing the config file! Not writing it back!

What it means

Thrown by writeConfig when free space on the filesystem holding the data directory is less than the encoded config size plus a 10240-byte safety margin. The guard exists specifically because a truncated configuration.json bricks the AIO instance, so the write is refused before any data touches disk.

Source

Thrown at php/src/Data/ConfigurationManager.php:844

        $this->set('password', $newPassword);
    }

    /**
     * @throws InvalidSettingConfigurationException
     */
    private function writeConfig() : void {
        if(!is_dir(DataConst::GetDataDirectory())) {
            throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!");
        }
        // Shouldn't happen, but as a precaution we won't write an empty config to disk.
        if ($this->config === []) {
            return;
        }
        $df = disk_free_space(DataConst::GetDataDirectory());
        $content = json_encode($this->config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
        $size = strlen($content) + 10240;
        if ($df !== false && (int)$df < $size) {
            throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not have enough space for writing the config file! Not writing it back!");
        }
        // Write to a temp file first to avoid truncating the config file if the
        // disk fills up mid-write. rename() is atomic on POSIX filesystems, so the
        // original config is never touched until the new content is fully on disk.
        $tempFile = DataConst::GetConfigFile() . '.tmp';
        if (file_put_contents($tempFile, $content) === false) {
            // The file probably wasn't created, but better check nonetheless.
            if (file_exists($tempFile)) {
                unlink($tempFile);
            }
            throw new InvalidSettingConfigurationException("Failed to write temporary config file: " . $tempFile);
        }
        if (!rename($tempFile, DataConst::GetConfigFile())) {
            unlink($tempFile);
            throw new InvalidSettingConfigurationException("Failed to rename " . $tempFile . " to " . DataConst::GetConfigFile());
        }
        $this->config = [];
    }

View on GitHub (pinned to 6b788eec5e)

Solutions

  1. Free space on the filesystem hosting the AIO data directory (remove snapshots, old backups, run `docker system prune` on the host) and retry.
  2. Check which filesystem is actually full: `df -h <host-path-of-data-dir>` rather than guessing.
  3. Enlarge the disk/volume if it is chronically small.
  4. If it already fired after a previous truncation, also inspect configuration.json for emptiness/corruption and restore from backup.

Example fix

// Pre-flight check before committing a settings change
$dir = DataConst::GetDataDirectory();
$free = disk_free_space($dir);
if ($free !== false && $free < 20480) {
    // refuse to proceed, alert operator
}
Defensive patterns

Strategy: try-catch

Validate before calling

$free = disk_free_space(DataConst::GetDataDirectory());
if ($free !== false && $free < strlen(json_encode($config)) + 10240) {
    // free space or abort before committing
}

Try / catch

try {
    $configurationManager->commit(); // or any setter that writes config
} catch (\AIO\Data\InvalidSettingConfigurationException $e) {
    if (str_contains($e->getMessage(), 'does not have enough space')) {
        // alert: disk full, config NOT written (original intact)
    }
}

Prevention

When it happens

Trigger: disk_free_space() on the data directory returns a value smaller than strlen(json config) + 10240 while committing any configuration change. Typical on a full root partition or a full dedicated volume that hosts the AIO data directory.

Common situations: Nextcloud data volume filled by user uploads/logs; host disk at 100% from Docker images/containers (docker system df); a small VDS where /var/lib/docker and the bind mount share a tiny disk; large backup caches filling the same filesystem.

Related errors


AI-assisted analysis of nextcloud/all-in-one@6b788eec5e (2026-08-21). Data as JSON: /api/errors/9861f23871df51c6. Report an issue: GitHub.