{"record":{"id":"e3b66b2a02c2c0b9","repo":"coollabsio/coolify","slug":"hostname-must-include-a-domain-e-g-example-com-o","errorCode":null,"errorMessage":"Hostname must include a domain (e.g. example.com or app.example.com).","messagePattern":"Hostname must include a domain \\(e\\.g\\. example\\.com or app\\.example\\.com\\)\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"app/Support/DomainConnect/CloudflareDomainConnect.php","lineNumber":149,"sourceCode":"     * Uses a small multi-part public-suffix set for common cases (e.g. co.uk)\n     * instead of shipping the full Mozilla Public Suffix List (~300KB).\n     * Unknown multi-part TLDs fall back to last-two-labels; Cloudflare will\n     * still match the user's zone when the guess is close enough.\n     *\n     * @return array{domain: string, host: string}\n     */\n    public static function splitHostname(string $hostname): array\n    {\n        $hostname = strtolower(trim($hostname));\n        $hostname = preg_replace('#^https?://#', '', $hostname) ?? $hostname;\n        $hostname = explode('/', $hostname)[0] ?? $hostname;\n        $hostname = explode(':', $hostname)[0] ?? $hostname;\n        $hostname = rtrim($hostname, '.');\n\n        $labels = array_values(array_filter(explode('.', $hostname), fn (string $p) => $p !== ''));\n\n        if (count($labels) < 2) {\n            throw new InvalidArgumentException('Hostname must include a domain (e.g. example.com or app.example.com).');\n        }\n\n        $suffixLabelCount = self::publicSuffixLabelCount($labels);\n        $registrableLabelCount = $suffixLabelCount + 1;\n\n        if (count($labels) < $registrableLabelCount) {\n            throw new InvalidArgumentException('Hostname must include a registrable domain.');\n        }\n\n        $domain = implode('.', array_slice($labels, -$registrableLabelCount));\n        $hostLabels = array_slice($labels, 0, -$registrableLabelCount);\n        $host = implode('.', $hostLabels);\n\n        return ['domain' => $domain, 'host' => $host];\n    }\n\n    /**\n     * How many trailing labels form the public suffix (effective TLD).","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Support/DomainConnect/CloudflareDomainConnect.php#L131-L167","documentation":"Error \"Hostname must include a domain (e.g. example.com or app.example.com).\" thrown in coollabsio/coolify.","triggerScenarios":"Thrown at app/Support/DomainConnect/CloudflareDomainConnect.php:149 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}