nextcloud/all-in-one · error · InvalidSettingConfigurationException

Domain is not a valid domain!

Error message

Domain is not a valid domain!

What it means

Fourth check in ConfigurationManager::setDomain(): the value must pass filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME), i.e. be an RFC-conformant hostname — labels of a-z/0-9/hyphen that do not start or end with a hyphen, no underscores, no spaces, no wildcard characters. Throws InvalidSettingConfigurationException → HTTP 422 in the AIO UI. Reaching this check means the basic shape (dot, no slash, no colon) already passed but a label is malformed.

Source

Thrown at php/src/Data/ConfigurationManager.php:614

    public function setDomain(string $domain, bool $skipDomainValidation) : void {
        // Validate that at least one dot is contained
        if (!str_contains($domain, '.')) {
            throw new InvalidSettingConfigurationException("Domain must contain at least one dot!");
        }

        // Validate that no slashes are contained
        if (str_contains($domain, '/')) {
            throw new InvalidSettingConfigurationException("Domain must not contain slashes!");
        }

        // Validate that no colons are contained
        if (str_contains($domain, ':')) {
            throw new InvalidSettingConfigurationException("Domain must not contain colons!");
        }

        // Validate domain
        if (filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) {
            throw new InvalidSettingConfigurationException("Domain is not a valid domain!");
        }

        // Validate that it is not an IP-address
        if(filter_var($domain, FILTER_VALIDATE_IP)) {
            throw new InvalidSettingConfigurationException("Please enter a domain and not an IP-address!");
        }

        // Skip domain validation if opted in to do so
        if ($this->shouldDomainValidationBeSkipped($skipDomainValidation)) {
            error_log('Skipping domain validation');
        } else {
            $dnsRecordIP = gethostbyname($domain);
            if ($dnsRecordIP === $domain) {
                $dnsRecordIP = '';
            }

            if (empty($dnsRecordIP)) {
                $record = dns_get_record($domain, DNS_AAAA);

View on GitHub (pinned to 6b788eec5e)

Solutions

  1. Replace underscores with hyphens and strip every character outside a-z, 0-9 and hyphen
  2. Remove leading/trailing hyphens from any label and trim whitespace around the value
  3. Verify locally before submitting: php -r 'var_dump(filter_var($d, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME));'

Example fix

// before
domain = 'my_cloud.example.com'
// after
domain = 'my-cloud.example.com'
Defensive patterns

Strategy: validation

Validate before calling

if (filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) {
    $errors[] = 'Domain is not a valid hostname (letters, digits, hyphens only)';
}

Try / catch

use AIO\Data\InvalidSettingConfigurationException;

try {
    $configurationManager->setDomain($domain, $skipDomainValidation);
} catch (InvalidSettingConfigurationException $e) {
    $formErrors[] = $e->getMessage();
}

Prevention

When it happens

Trigger: Underscores in a label ('my_cloud.example.com'); a label starting/ending with a hyphen ('-prod.cloud.example.com'); a label longer than 63 characters; pasted spaces or unicode characters; wildcard entries ('*.example.com'); an email address ('admin@example.com').

Common situations: Users assuming underscores are legal in hostnames (common for internal names); hidden whitespace from copy-paste; wildcard expectations carried over from other web-server configs.

Related errors


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