{"record":{"id":"ad1d9b0460bd0c77","repo":"nextcloud/all-in-one","slug":"domain-is-not-a-valid-domain","errorCode":null,"errorMessage":"Domain is not a valid domain!","messagePattern":"Domain is not a valid domain!","errorType":"validation","errorClass":"InvalidSettingConfigurationException","httpStatus":422,"severity":"error","filePath":"php/src/Data/ConfigurationManager.php","lineNumber":614,"sourceCode":"    public function setDomain(string $domain, bool $skipDomainValidation) : void {\n        // Validate that at least one dot is contained\n        if (!str_contains($domain, '.')) {\n            throw new InvalidSettingConfigurationException(\"Domain must contain at least one dot!\");\n        }\n\n        // Validate that no slashes are contained\n        if (str_contains($domain, '/')) {\n            throw new InvalidSettingConfigurationException(\"Domain must not contain slashes!\");\n        }\n\n        // Validate that no colons are contained\n        if (str_contains($domain, ':')) {\n            throw new InvalidSettingConfigurationException(\"Domain must not contain colons!\");\n        }\n\n        // Validate domain\n        if (filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) {\n            throw new InvalidSettingConfigurationException(\"Domain is not a valid domain!\");\n        }\n\n        // Validate that it is not an IP-address\n        if(filter_var($domain, FILTER_VALIDATE_IP)) {\n            throw new InvalidSettingConfigurationException(\"Please enter a domain and not an IP-address!\");\n        }\n\n        // Skip domain validation if opted in to do so\n        if ($this->shouldDomainValidationBeSkipped($skipDomainValidation)) {\n            error_log('Skipping domain validation');\n        } else {\n            $dnsRecordIP = gethostbyname($domain);\n            if ($dnsRecordIP === $domain) {\n                $dnsRecordIP = '';\n            }\n\n            if (empty($dnsRecordIP)) {\n                $record = dns_get_record($domain, DNS_AAAA);","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Data/ConfigurationManager.php#L596-L632","documentation":"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.","triggerScenarios":"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').","commonSituations":"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.","solutions":["Replace underscores with hyphens and strip every character outside a-z, 0-9 and hyphen","Remove leading/trailing hyphens from any label and trim whitespace around the value","Verify locally before submitting: php -r 'var_dump(filter_var($d, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME));'"],"exampleFix":"// before\ndomain = 'my_cloud.example.com'\n// after\ndomain = 'my-cloud.example.com'","handlingStrategy":"validation","validationCode":"if (filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) {\n    $errors[] = 'Domain is not a valid hostname (letters, digits, hyphens only)';\n}","typeGuard":null,"tryCatchPattern":"use AIO\\Data\\InvalidSettingConfigurationException;\n\ntry {\n    $configurationManager->setDomain($domain, $skipDomainValidation);\n} catch (InvalidSettingConfigurationException $e) {\n    $formErrors[] = $e->getMessage();\n}","preventionTips":["Run the same filter_var(..., FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) check client- or server-side before submitting","Ban underscores and wildcards in domain inputs at the form level","Trim and strip invisible characters from pasted values"],"tags":["php","nextcloud-aio","domain-validation","hostname","configuration"],"backgroundTag":"invalid-domain-format","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}