{"record":{"id":"6f76109db25696f1","repo":"nextcloud/all-in-one","slug":"please-enter-a-path-or-a-remote-repo-url","errorCode":null,"errorMessage":"Please enter a path or a remote repo url!","messagePattern":"Please enter a path or a remote repo url!","errorType":"validation","errorClass":"InvalidSettingConfigurationException","httpStatus":422,"severity":"error","filePath":"php/src/Data/ConfigurationManager.php","lineNumber":729,"sourceCode":"            return \"\";\n        }\n        return 'dc=' . implode(',dc=', explode('.', $domain));\n    }\n\n    /**\n     * @throws InvalidSettingConfigurationException\n     */\n    public function setBorgLocationVars(string $location, string $repo) : void {\n        $this->validateBorgLocationVars($location, $repo);\n        $this->startTransaction();\n        $this->borgBackupHostLocation = $location;\n        $this->borgRemoteRepo = $repo;\n        $this->commitTransaction();\n    }\n\n    private function validateBorgLocationVars(string $location, string $repo) : void {\n        if ($location === '' && $repo === '') {\n            throw new InvalidSettingConfigurationException(\"Please enter a path or a remote repo url!\");\n        } elseif ($location !== '' && $repo !== '') {\n            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","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Data/ConfigurationManager.php#L711-L747","documentation":"ConfigurationManager::setBorgLocationVars() (and setBorgRestoreLocationVarsAndPassword(), which reuses the same validator) requires exactly one of the two backup-location inputs: a local path ($location) or a borg remote repository URL ($repo). Submitting the AIO backup or restore form with both fields empty throws InvalidSettingConfigurationException → HTTP 422 with this message shown in the interface. Note that the controller calls setBorgLocationVars whenever either form key is present in the POST body, even if both values are empty strings.","triggerScenarios":"Clicking submit on the Borg backup-location form without filling either 'borg_backup_host_location' or 'borg_remote_repo'; a POST to /api/docker/config whose body contains one of the keys but with empty values; the restore form submitted with only the password filled in.","commonSituations":"Accidental submit of an empty form; client scripts posting the config endpoint with empty strings for both keys; whitespace-only input that looks non-empty to the user.","solutions":["Fill in exactly one of the two fields: an absolute path like '/mnt/backup', the docker volume name 'nextcloud_aio_backupdir', or a remote repo URL like 'ssh://user@host:22/./repo'","If the goal was to clear the backup location, use the dedicated delete action (deleteBorgBackupLocationItems) instead of submitting empty values","Check for whitespace-only values — trim before submitting"],"exampleFix":"// before\nborg_backup_host_location = ''\nborg_remote_repo = ''\n// after\nborg_backup_host_location = '/mnt/aio-backup'\nborg_remote_repo = ''","handlingStrategy":"validation","validationCode":"$hasPath = trim($location) !== '';\n$hasRepo = trim($repo) !== '';\nif (!$hasPath && !$hasRepo) {\n    $errors[] = 'Provide a backup path or a remote repo url';\n} elseif ($hasPath && $hasRepo) {\n    $errors[] = 'Provide only one of path or remote repo';\n}","typeGuard":null,"tryCatchPattern":"use AIO\\Data\\InvalidSettingConfigurationException;\n\ntry {\n    $configurationManager->setBorgLocationVars($location, $repo);\n} catch (InvalidSettingConfigurationException $e) {\n    $formErrors[] = $e->getMessage(); // shown verbatim in the AIO UI\n}","preventionTips":["Disable the submit button until exactly one of the two fields is non-empty","Trim inputs before validation so whitespace-only values fail client-side","Use the dedicated delete action to clear the location instead of posting empty fields"],"tags":["php","nextcloud-aio","borg-backup","configuration","input-validation"],"backgroundTag":"missing-required-field","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}