{"record":{"id":"f55b4290021d9613","repo":"nextcloud/all-in-one","slug":"dataconst-getdatadirectory-does-not-exist-s","errorCode":null,"errorMessage":"${DataConst::GetDataDirectory()} does not exist! Something was set up falsely!","messagePattern":"(.+?) does not exist! Something was set up falsely!","errorType":"exception","errorClass":"InvalidSettingConfigurationException","httpStatus":422,"severity":"error","filePath":"php/src/Data/ConfigurationManager.php","lineNumber":834,"sourceCode":"\n        if (strlen($newPassword) < 24) {\n            throw new InvalidSettingConfigurationException(\"New passwords must be >= 24 digits.\");\n        }\n\n        if (!preg_match(\"#^[a-zA-Z0-9 ]+$#\", $newPassword)) {\n            throw new InvalidSettingConfigurationException('Not allowed characters in the new password.');\n        }\n\n        // All checks pass so set the password\n        $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)) {","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Data/ConfigurationManager.php#L816-L852","documentation":"Thrown by ConfigurationManager::writeConfig when the AIO data directory (DataConst::GetDataDirectory()) is not a directory at commit time. Every config write (set(), password change, backup time, etc.) goes through writeConfig, so any successful settings change suddenly failing with this usually means the host-mounted volume disappeared from the container.","triggerScenarios":"Any configuration setter is committed while is_dir() on the data directory returns false: the Docker volume backing nextcloud_aio_nextcloud_data was unmounted, the bind-mount source was removed, or the container was started with a wrong volume spec so the path never existed.","commonSituations":"Host reboot losing an NFS/SMB mount that backs the data directory; docker volume pruned (docker volume prune) while the container runs; migrating the data dir by moving it on the host without updating the mount; typo in the docker run/compose volume path.","solutions":["Verify the mount inside the container: `docker exec nextcloud-aio-nextcloud ls -ld <data-dir>` and compare with `docker inspect` Mounts.","Restore the host-side mount (restart NFS/SMB, re-mount the disk) and retry the settings change.","If the volume was pruned/removed, restore the data directory (configuration.json, backupsecret, borg keys) from backup before changing any settings.","Fix the volume specification in the mastercontainer start command/compose file and recreate the container."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$dir = DataConst::GetDataDirectory();\nif (!is_dir($dir)) {\n    // abort the settings change and alert on the missing mount\n}","typeGuard":"function isAioDataDirMounted(string $dir): bool\n{\n    return is_dir($dir) && is_writable($dir);\n}","tryCatchPattern":"try {\n    $configurationManager->setDailyBackupTime('04:00', true, true);\n} catch (\\AIO\\Data\\InvalidSettingConfigurationException $e) {\n    // message contains the data dir path; treat as environment failure, do not retry blindly\n    $logger->error($e->getMessage());\n}","preventionTips":["Monitor the data-directory mount (exists + writable) as a healthcheck before config changes.","Never bind-mount configuration.json as a single file; mount its parent directory.","Protect AIO volumes from `docker volume prune` via labels or prune filters."],"tags":["php","nextcloud-aio","docker","filesystem","volume-mount","configuration"],"backgroundTag":"missing-data-directory","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}