{"record":{"id":"d52c87b8a3a0a3cb","repo":"nextcloud/all-in-one","slug":"the-path-must-not-be-a-children-of-or-equal-to-nex","errorCode":null,"errorMessage":"The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to ${nextcloudDatadirMount}","messagePattern":"The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to (.+?)","errorType":"validation","errorClass":"InvalidSettingConfigurationException","httpStatus":422,"severity":"error","filePath":"php/src/Data/ConfigurationManager.php","lineNumber":749,"sourceCode":"            throw new InvalidSettingConfigurationException(\"Location and remote repo url are mutually exclusive!\");\n        }\n\n        if ($location !== '') {\n            $isValidPath = false;\n            if (str_starts_with($location, '/') && !str_ends_with($location, '/')) {\n                $isValidPath = true;\n            } elseif ($location === 'nextcloud_aio_backupdir') {\n                $isValidPath = true;\n            }\n\n            if (!$isValidPath) {\n                throw new InvalidSettingConfigurationException(\"The path must start with '/', and must not end with '/'! Another option is to use the docker volume name 'nextcloud_aio_backupdir'.\");\n            }\n\n            // Prevent backup to be contained in Nextcloud Datadir as this will delete the backup archive upon restore\n            // See https://github.com/nextcloud/all-in-one/issues/6607\n            if (str_starts_with($location . '/', rtrim($this->nextcloudDatadirMount, '/') . '/')) {\n                throw new InvalidSettingConfigurationException(\"The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to \" . $this->nextcloudDatadirMount);\n            }\n\n        } else {\n            $this->validateBorgRemoteRepo($repo);\n        }\n    }\n\n    private function validateBorgRemoteRepo(string $repo) : void {\n        $commonMsg = \"For valid urls, see the remote examples at https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls\";\n        if ($repo === \"\") {\n            // Ok, remote repo is optional\n        } elseif (!str_contains($repo, \"@\")) {\n            throw new InvalidSettingConfigurationException(\"The remote repo must contain '@'. $commonMsg\");\n        } elseif (!str_contains($repo, \":\")) {\n            throw new InvalidSettingConfigurationException(\"The remote repo must contain ':'. $commonMsg\");\n        }\n    }\n","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Data/ConfigurationManager.php#L731-L767","documentation":"Guard in validateBorgLocationVars(): the backup location must not be equal to or a child of the configured NEXTCLOUD_DATADIR mount (checked via str_starts_with($location.'/', rtrim($datadir,'/').'/')). AIO refuses because a backup stored inside the datadir would be destroyed when a restore re-initializes the datadir (nextcloud/all-in-one#6607). Throws InvalidSettingConfigurationException → HTTP 422 with the current datadir value included in the message.","triggerScenarios":"NEXTCLOUD_DATADIR=/mnt/ncdata with borg_backup_host_location='/mnt/ncdata/backup' or '/mnt/ncdata' itself; sibling paths like '/mnt/ncdata-backup' or '/mnt/other' are accepted because the check is a proper path-prefix test.","commonSituations":"Single-disk setups where users try to keep everything under one data tree; not knowing the datadir is wiped during a borg restore.","solutions":["Choose a location outside the datadir tree, e.g. '/mnt/backup' when the datadir is '/mnt/ncdata'","Or use the dedicated docker volume name 'nextcloud_aio_backupdir'","If a shared disk is the constraint, create and mount a separate directory for backups"],"exampleFix":"# before\nNEXTCLOUD_DATADIR=/mnt/ncdata\nborg_backup_host_location = '/mnt/ncdata/backup'\n# after\nNEXTCLOUD_DATADIR=/mnt/ncdata\nborg_backup_host_location = '/mnt/backup'","handlingStrategy":"validation","validationCode":"// Mirror the mastercontainer's prefix check against the configured datadir\n$datadir = '/mnt/ncdata'; // read from the same source as NEXTCLOUD_DATADIR\nif (str_starts_with(rtrim($location, '/') . '/', rtrim($datadir, '/') . '/')) {\n    $errors[] = \"Backup path must not be inside or equal to $datadir\";\n}","typeGuard":null,"tryCatchPattern":"use AIO\\Data\\InvalidSettingConfigurationException;\n\ntry {\n    $configurationManager->setBorgLocationVars($location, $repo);\n} catch (InvalidSettingConfigurationException $e) {\n    // message names the current datadir; suggest a sibling directory instead\n    $formErrors[] = $e->getMessage();\n}","preventionTips":["Plan a dedicated backup mount outside the datadir from the start","Expose the configured NEXTCLOUD_DATADIR in the UI and warn live while the user types a location under it","Remember why the guard exists: restores wipe the datadir (issue #6607)"],"tags":["php","nextcloud-aio","borg-backup","path-validation","datadir","configuration"],"backgroundTag":"forbidden-backup-path","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}