nextcloud/all-in-one · error · InvalidSettingConfigurationException
The path must not be a children of or equal to NEXTCLOUD_DAT
Error message
The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to ${nextcloudDatadirMount} What it means
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.
Source
Thrown at php/src/Data/ConfigurationManager.php:749
throw new InvalidSettingConfigurationException("Location and remote repo url are mutually exclusive!");
}
if ($location !== '') {
$isValidPath = false;
if (str_starts_with($location, '/') && !str_ends_with($location, '/')) {
$isValidPath = true;
} elseif ($location === 'nextcloud_aio_backupdir') {
$isValidPath = true;
}
if (!$isValidPath) {
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'.");
}
// Prevent backup to be contained in Nextcloud Datadir as this will delete the backup archive upon restore
// See https://github.com/nextcloud/all-in-one/issues/6607
if (str_starts_with($location . '/', rtrim($this->nextcloudDatadirMount, '/') . '/')) {
throw new InvalidSettingConfigurationException("The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to " . $this->nextcloudDatadirMount);
}
} else {
$this->validateBorgRemoteRepo($repo);
}
}
private function validateBorgRemoteRepo(string $repo) : void {
$commonMsg = "For valid urls, see the remote examples at https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls";
if ($repo === "") {
// Ok, remote repo is optional
} elseif (!str_contains($repo, "@")) {
throw new InvalidSettingConfigurationException("The remote repo must contain '@'. $commonMsg");
} elseif (!str_contains($repo, ":")) {
throw new InvalidSettingConfigurationException("The remote repo must contain ':'. $commonMsg");
}
}
View on GitHub (pinned to 6b788eec5e)
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
Example fix
# before NEXTCLOUD_DATADIR=/mnt/ncdata borg_backup_host_location = '/mnt/ncdata/backup' # after NEXTCLOUD_DATADIR=/mnt/ncdata borg_backup_host_location = '/mnt/backup'
Defensive patterns
Strategy: validation
Validate before calling
// Mirror the mastercontainer's prefix check against the configured datadir
$datadir = '/mnt/ncdata'; // read from the same source as NEXTCLOUD_DATADIR
if (str_starts_with(rtrim($location, '/') . '/', rtrim($datadir, '/') . '/')) {
$errors[] = "Backup path must not be inside or equal to $datadir";
} Try / catch
use AIO\Data\InvalidSettingConfigurationException;
try {
$configurationManager->setBorgLocationVars($location, $repo);
} catch (InvalidSettingConfigurationException $e) {
// message names the current datadir; suggest a sibling directory instead
$formErrors[] = $e->getMessage();
} Prevention
- 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)
When it happens
Trigger: 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.
Common situations: Single-disk setups where users try to keep everything under one data tree; not knowing the datadir is wiped during a borg restore.
Related errors
- The path must start with '/', and must not end with '/'! Ano
- Please enter a path or a remote repo url!
- Location and remote repo url are mutually exclusive!
- The remote repo must contain '@'. For valid urls, see the re
- The remote repo must contain ':'. For valid urls, see the re
AI-assisted analysis of nextcloud/all-in-one@6b788eec5e (2026-08-21).
Data as JSON: /api/errors/d52c87b8a3a0a3cb.
Report an issue: GitHub.