coollabsio/coolify · error · InvalidArgumentException

Hostname must include a registrable domain.

Error message

Hostname must include a registrable domain.

What it means

Error "Hostname must include a registrable domain." thrown in coollabsio/coolify.

Source

Thrown at app/Support/DomainConnect/CloudflareDomainConnect.php:156

    public static function splitHostname(string $hostname): array
    {
        $hostname = strtolower(trim($hostname));
        $hostname = preg_replace('#^https?://#', '', $hostname) ?? $hostname;
        $hostname = explode('/', $hostname)[0] ?? $hostname;
        $hostname = explode(':', $hostname)[0] ?? $hostname;
        $hostname = rtrim($hostname, '.');

        $labels = array_values(array_filter(explode('.', $hostname), fn (string $p) => $p !== ''));

        if (count($labels) < 2) {
            throw new InvalidArgumentException('Hostname must include a domain (e.g. example.com or app.example.com).');
        }

        $suffixLabelCount = self::publicSuffixLabelCount($labels);
        $registrableLabelCount = $suffixLabelCount + 1;

        if (count($labels) < $registrableLabelCount) {
            throw new InvalidArgumentException('Hostname must include a registrable domain.');
        }

        $domain = implode('.', array_slice($labels, -$registrableLabelCount));
        $hostLabels = array_slice($labels, 0, -$registrableLabelCount);
        $host = implode('.', $hostLabels);

        return ['domain' => $domain, 'host' => $host];
    }

    /**
     * How many trailing labels form the public suffix (effective TLD).
     *
     * @param  list<string>  $labels
     */
    protected static function publicSuffixLabelCount(array $labels): int
    {
        $count = count($labels);

View on GitHub (pinned to 70b9acc424)

When it happens

Trigger: Thrown at app/Support/DomainConnect/CloudflareDomainConnect.php:156 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17). Data as JSON: /api/errors/dce7a5276fd4e761. Report an issue: GitHub.