{"record":{"id":"ce6252654bd920a7","repo":"nextcloud/all-in-one","slug":"the-desired-subdomain-must-contain-only-lowercase","errorCode":null,"errorMessage":"The desired subdomain must contain only lowercase letters, digits and hyphens, be between 1 and 63 characters long, and must not start or end with a hyphen.","messagePattern":"The desired subdomain must contain only lowercase letters, digits and hyphens, be between 1 and 63 characters long, and must not start or end with a hyphen\\.","errorType":"validation","errorClass":"\\Exception","httpStatus":422,"severity":"warning","filePath":"php/src/Desec/DesecManager.php","lineNumber":174,"sourceCode":"     */\n    private function validateEmail(string $email): string {\n        $email = trim($email);\n        if ($email === '' || filter_var($email, FILTER_VALIDATE_EMAIL) === false) {\n            throw new \\Exception('Please provide a valid email address.');\n        }\n        return $email;\n    }\n\n    /**\n     * Validates an optional subdomain slug.\n     * Returns an empty string when the caller wants a randomly generated slug.\n     *\n     * @throws \\Exception if the slug is non-empty but does not match the allowed pattern\n     */\n    private function validateSlug(string $slug): string {\n        $slug = trim($slug);\n        if ($slug !== '' && !preg_match(self::SLUG_PATTERN, $slug)) {\n            throw new \\Exception(\n                'The desired subdomain must contain only lowercase letters, digits and hyphens, '\n                . 'be between 1 and 63 characters long, and must not start or end with a hyphen.'\n            );\n        }\n        return $slug;\n    }\n\n    /**\n     * Requests creation of a new deSEC account.\n     *\n     * deSEC replies 202 Accepted and emails a verification link; no API token is\n     * returned here and the account is unusable until the email is verified. For\n     * privacy reasons deSEC also returns 202 when the email is already registered\n     * (without sending a mail), so a 202 cannot be treated as proof of a new account.\n     * The captcha field is omitted; deSEC requires it only at email-verification time,\n     * which the user completes in the browser via the emailed link.\n     *\n     * @throws \\Exception on network failure or an unexpected HTTP response","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Desec/DesecManager.php#L156-L192","documentation":"Thrown by DesecManager::validateSlug when a non-empty slug fails SLUG_PATTERN: lowercase letters, digits and hyphens only, 1-63 characters, no leading/trailing hyphen (standard DNS label rules for the subdomain under the deSEC domain). An empty slug is valid and means 'generate a random one'.","triggerScenarios":"Calling register() with a slug containing uppercase ('MyHost'), underscores, dots, or other symbols; a slug of 64+ characters; a slug like '-blog' or 'blog-'; a full domain name ('blog.dedyn.io') instead of the bare label.","commonSituations":"Typing the whole domain instead of the subdomain part; underscores from machine hostnames; case preserved by autocapitalizing mobile keyboards; using reserved/odd labels copied from internal naming schemes.","solutions":["Use a plain lowercase DNS label: 'mycloud', 'nc-01', letters/digits/hyphens only, 1-63 chars, hyphens only in the middle.","Strip the domain suffix if you pasted the full hostname.","Leave the slug empty to let AIO generate a valid random subdomain."],"exampleFix":"// before\n$slug = 'MyCloud._dedyn.io';\n\n// after\n$slug = 'mycloud';","handlingStrategy":"validation","validationCode":"$slug = strtolower(trim($slug));\nif ($slug !== '' && !preg_match('#^(?!-)[a-z0-9-]{1,63}(?<!-)$#', $slug)) {\n    // reject before calling register()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lowercase and strip domains/underscores before submitting a slug.","Leave the slug blank to accept a randomly generated one."],"tags":["php","nextcloud-aio","desec","slug-validation","dns","input-validation"],"backgroundTag":"invalid-slug-format","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}