{"record":{"id":"9861f23871df51c6","repo":"nextcloud/all-in-one","slug":"dataconst-getdatadirectory-does-not-have-eno","errorCode":null,"errorMessage":"${DataConst::GetDataDirectory()} does not have enough space for writing the config file! Not writing it back!","messagePattern":"(.+?) does not have enough space for writing the config file! Not writing it back!","errorType":"exception","errorClass":"InvalidSettingConfigurationException","httpStatus":422,"severity":"error","filePath":"php/src/Data/ConfigurationManager.php","lineNumber":844,"sourceCode":"        $this->set('password', $newPassword);\n    }\n\n    /**\n     * @throws InvalidSettingConfigurationException\n     */\n    private function writeConfig() : void {\n        if(!is_dir(DataConst::GetDataDirectory())) {\n            throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . \" does not exist! Something was set up falsely!\");\n        }\n        // Shouldn't happen, but as a precaution we won't write an empty config to disk.\n        if ($this->config === []) {\n            return;\n        }\n        $df = disk_free_space(DataConst::GetDataDirectory());\n        $content = json_encode($this->config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);\n        $size = strlen($content) + 10240;\n        if ($df !== false && (int)$df < $size) {\n            throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . \" does not have enough space for writing the config file! Not writing it back!\");\n        }\n        // Write to a temp file first to avoid truncating the config file if the\n        // disk fills up mid-write. rename() is atomic on POSIX filesystems, so the\n        // original config is never touched until the new content is fully on disk.\n        $tempFile = DataConst::GetConfigFile() . '.tmp';\n        if (file_put_contents($tempFile, $content) === false) {\n            // The file probably wasn't created, but better check nonetheless.\n            if (file_exists($tempFile)) {\n                unlink($tempFile);\n            }\n            throw new InvalidSettingConfigurationException(\"Failed to write temporary config file: \" . $tempFile);\n        }\n        if (!rename($tempFile, DataConst::GetConfigFile())) {\n            unlink($tempFile);\n            throw new InvalidSettingConfigurationException(\"Failed to rename \" . $tempFile . \" to \" . DataConst::GetConfigFile());\n        }\n        $this->config = [];\n    }","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Data/ConfigurationManager.php#L826-L862","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Free space on the filesystem hosting the AIO data directory (remove snapshots, old backups, run `docker system prune` on the host) and retry.","Check which filesystem is actually full: `df -h <host-path-of-data-dir>` rather than guessing.","Enlarge the disk/volume if it is chronically small.","If it already fired after a previous truncation, also inspect configuration.json for emptiness/corruption and restore from backup."],"exampleFix":"// Pre-flight check before committing a settings change\n$dir = DataConst::GetDataDirectory();\n$free = disk_free_space($dir);\nif ($free !== false && $free < 20480) {\n    // refuse to proceed, alert operator\n}","handlingStrategy":"try-catch","validationCode":"$free = disk_free_space(DataConst::GetDataDirectory());\nif ($free !== false && $free < strlen(json_encode($config)) + 10240) {\n    // free space or abort before committing\n}","typeGuard":null,"tryCatchPattern":"try {\n    $configurationManager->commit(); // or any setter that writes config\n} catch (\\AIO\\Data\\InvalidSettingConfigurationException $e) {\n    if (str_contains($e->getMessage(), 'does not have enough space')) {\n        // alert: disk full, config NOT written (original intact)\n    }\n}","preventionTips":["Keep an alert on the filesystem hosting the AIO data directory at >90% usage.","Periodically prune Docker images/containers and old backups on the host."],"tags":["php","nextcloud-aio","disk-space","filesystem","configuration","docker"],"backgroundTag":"disk-full","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}