nextcloud/all-in-one · warning · \Exception

The desired subdomain must contain only lowercase letters, d

Error message

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.

What it means

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'.

Source

Thrown at php/src/Desec/DesecManager.php:174

     */
    private function validateEmail(string $email): string {
        $email = trim($email);
        if ($email === '' || filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
            throw new \Exception('Please provide a valid email address.');
        }
        return $email;
    }

    /**
     * Validates an optional subdomain slug.
     * Returns an empty string when the caller wants a randomly generated slug.
     *
     * @throws \Exception if the slug is non-empty but does not match the allowed pattern
     */
    private function validateSlug(string $slug): string {
        $slug = trim($slug);
        if ($slug !== '' && !preg_match(self::SLUG_PATTERN, $slug)) {
            throw new \Exception(
                '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.'
            );
        }
        return $slug;
    }

    /**
     * Requests creation of a new deSEC account.
     *
     * deSEC replies 202 Accepted and emails a verification link; no API token is
     * returned here and the account is unusable until the email is verified. For
     * privacy reasons deSEC also returns 202 when the email is already registered
     * (without sending a mail), so a 202 cannot be treated as proof of a new account.
     * The captcha field is omitted; deSEC requires it only at email-verification time,
     * which the user completes in the browser via the emailed link.
     *
     * @throws \Exception on network failure or an unexpected HTTP response

View on GitHub (pinned to 6b788eec5e)

Solutions

  1. Use a plain lowercase DNS label: 'mycloud', 'nc-01', letters/digits/hyphens only, 1-63 chars, hyphens only in the middle.
  2. Strip the domain suffix if you pasted the full hostname.
  3. Leave the slug empty to let AIO generate a valid random subdomain.

Example fix

// before
$slug = 'MyCloud._dedyn.io';

// after
$slug = 'mycloud';
Defensive patterns

Strategy: validation

Validate before calling

$slug = strtolower(trim($slug));
if ($slug !== '' && !preg_match('#^(?!-)[a-z0-9-]{1,63}(?<!-)$#', $slug)) {
    // reject before calling register()
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nextcloud/all-in-one@6b788eec5e (2026-08-21). Data as JSON: /api/errors/ce6252654bd920a7. Report an issue: GitHub.