{"record":{"id":"bf96e05cf1f95740","repo":"nextcloud/all-in-one","slug":"the-remote-repo-must-contain-for-valid-urls","errorCode":null,"errorMessage":"The remote repo must contain '@'. For valid urls, see the remote examples at https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls","messagePattern":"The remote repo must contain '@'\\. For valid urls, see the remote examples at https://borgbackup\\.readthedocs\\.io/en/stable/usage/general\\.html#repository-urls","errorType":"validation","errorClass":"InvalidSettingConfigurationException","httpStatus":422,"severity":"error","filePath":"php/src/Data/ConfigurationManager.php","lineNumber":762,"sourceCode":"            }\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\n    public function deleteBorgBackupLocationItems() : void {\n        // Delete the variables\n        $this->startTransaction();\n        $this->borgBackupHostLocation = '';\n        $this->borgRemoteRepo = '';\n        $this->commitTransaction();\n\n        // Also delete the borg config file to be able to start over\n        if (file_exists(DataConst::GetBackupKeyFile())) {\n            if (unlink(DataConst::GetBackupKeyFile())) {\n                error_log('borg.config file deleted to be able to start over.');\n            }\n        }","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Data/ConfigurationManager.php#L744-L780","documentation":"First rule of validateBorgRemoteRepo() (called from validateBorgLocationVars() when only a remote repo was given): a borg remote repository URL must contain '@' — the user part of 'user@host:repo' shorthand or of full URLs like 'ssh://user@host:port/repo'. Missing '@' throws InvalidSettingConfigurationException → HTTP 422, and the message links borg's repository-URL documentation.","triggerScenarios":"Submitting 'ssh://host:22/./repo' (no user), 'host:/repo', or a bare path-like string as the remote repo; a URL assembled by string concatenation that dropped the user segment.","commonSituations":"Users unfamiliar with borg's ssh URL syntax; scripts building the URL from parts and omitting the username; copy from a tutorial that used key-based host aliases.","solutions":["Include the ssh user, e.g. 'ssh://borg@backup.example.com:22/./repo' or the shorthand 'borg@backup.example.com:./repo'","Check the borg repository-URL docs linked in the message for all supported schemes","If a local path was intended, clear the remote-repo field and use the path field instead"],"exampleFix":"// before\nborg_remote_repo = 'ssh://backup.example.com:22/./repo'\n// after\nborg_remote_repo = 'ssh://borg@backup.example.com:22/./repo'","handlingStrategy":"validation","validationCode":"if (trim($repo) !== '' && !str_contains($repo, '@')) {\n    $errors[] = \"Remote repo url must contain '@' (user@host), e.g. ssh://borg@host:22/./repo\";\n}","typeGuard":null,"tryCatchPattern":"use AIO\\Data\\InvalidSettingConfigurationException;\n\ntry {\n    $configurationManager->setBorgLocationVars($location, $repo);\n} catch (InvalidSettingConfigurationException $e) {\n    $formErrors[] = $e->getMessage(); // includes the borg URL docs link\n}","preventionTips":["Use borg's documented URL forms: 'ssh://user@host:port/path' or 'user@host:path'","Build repo URLs from explicit user/host/path parts instead of string concatenation","Validate for '@' and ':' together before submitting"],"tags":["php","nextcloud-aio","borg-backup","url-validation","configuration"],"backgroundTag":"invalid-repository-url","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}