{"record":{"id":"31dae9ca5bd1f76c","repo":"nextcloud/all-in-one","slug":"domain-is-already-taken-please-choose-a-diffe","errorCode":null,"errorMessage":"\"{domain}\" is already taken. Please choose a different subdomain and try again.","messagePattern":"\"(.+?)\" is already taken\\. Please choose a different subdomain and try again\\.","errorType":"exception","errorClass":"\\Exception","httpStatus":422,"severity":"error","filePath":"php/src/Desec/DesecManager.php","lineNumber":320,"sourceCode":"            if ($code === 201) {\n                return $domain;\n            }\n\n            // For a user-specified slug, the name may be unavailable (400/409) or the account's\n            // domain limit may be reached (403) precisely because the user already owns this\n            // domain. Reuse it rather than failing.\n            if (!$random && ($code === 400 || $code === 403 || $code === 409)) {\n                if ($this->ownsDomain($token, $domain)) {\n                    return $domain;\n                }\n                if ($code === 403) {\n                    throw new \\Exception(\n                        'Your deSEC account has reached its domain limit and \"' . $domain . '\" is not '\n                        . 'one of your existing domains. Remove an unused domain at desec.io, or contact '\n                        . 'deSEC support to raise the limit, then try again.'\n                    );\n                }\n                throw new \\Exception('\"' . $domain . '\" is already taken. Please choose a different subdomain and try again.');\n            }\n\n            if ($code === 409) {\n                // Random slug collided with an existing name — try another.\n                continue;\n            }\n\n            throw new \\Exception('Unexpected response from deSEC during domain registration (HTTP ' . $code . '): ' . $res->getBody()->getContents());\n        }\n\n        throw new \\Exception('Could not register a free dedyn.io domain after ' . self::MAX_SLUG_ATTEMPTS . ' attempts. Please try again.');\n    }\n\n    /**\n     * Checks whether the authenticated account already owns the given domain.\n     *\n     * Used to recover from a failed creation when the user is reusing a slug they\n     * registered earlier: GET /domains/{name}/ returns 200 only for a domain the","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Desec/DesecManager.php#L302-L338","documentation":"POST /domains/ returned 400 or 409 for a user-chosen slug, and the follow-up GET /domains/{name}/ returned 404, proving the account does not already own it. The dedyn.io subdomain is registered to someone else (409 collision) or the name failed validation (400).","triggerScenarios":"Another deSEC user already registered <slug>.dedyn.io; the slug violates the naming rules so deSEC rejects it with 400 and it is not owned by this account.","commonSituations":"Short popular slugs like 'cloud' or 'nextcloud' are long taken; user types an invalid name; user previously registered the slug under a different deSEC account.","solutions":["Choose a different, more unique subdomain","Check slug syntax: lowercase letters, digits, hyphens, must start and end alphanumerically","If you believe you own it, confirm you authenticated with the same deSEC account that registered it — ownership is per-account"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Cheap pre-check: if the account already owns the slug, creation will self-heal;\n// validate slug syntax client-side to avoid the 400 variant\nif (!preg_match('/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/', $slug)) {\n    throw new \\InvalidArgumentException('Slug must be lowercase letters, digits, hyphens; no leading/trailing hyphen.');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $domain = $manager->registerDomain($token, $slug);\n} catch (\\Exception $e) {\n    if (str_contains($e->getMessage(), 'is already taken')) {\n        showFieldError('slug', 'That subdomain is taken — pick another or leave blank for a random one');\n        return;\n    }\n    throw $e;\n}","preventionTips":["Validate slug syntax client-side before submitting (lowercase alphanumeric + inner hyphens)","Default to a random slug; user-chosen slugs are mostly taken already","Prefer longer unique slugs (hostnames, project names) over generic words"],"tags":["php","desec","domains","conflict"],"backgroundTag":"name-already-taken","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}