coollabsio/coolify · error · RuntimeException

A valid target instance URL is required (e.g. http://localho

Error message

A valid target instance URL is required (e.g. http://localhost:8001).

What it means

Error "A valid target instance URL is required (e.g. http://localhost:8001)." thrown in coollabsio/coolify.

Source

Thrown at app/Services/ServerTransfer/ServerTransferMigrator.php:98

            );
        }

        return [
            'server_uuid' => $server->uuid,
            'export_id' => is_string($exportId) ? $exportId : null,
            'target_url' => $targetUrl,
            'import' => $importBody,
            'complete' => $complete,
            'warnings' => $warnings,
            'message' => 'Server migrated to '.$targetUrl.'. Automations disabled on this instance.',
        ];
    }

    private function normalizeTargetUrl(string $targetUrl): string
    {
        $targetUrl = rtrim(trim($targetUrl), '/');
        if ($targetUrl === '' || ! filter_var($targetUrl, FILTER_VALIDATE_URL)) {
            throw new RuntimeException('A valid target instance URL is required (e.g. http://localhost:8001).');
        }

        // From inside Docker, localhost is this container — use the host gateway for peer instances.
        if (file_exists('/.dockerenv') || is_file('/run/.containerenv')) {
            $targetUrl = (string) preg_replace(
                '#^(https?://)(localhost|127\.0\.0\.1)(?=[:/]|$)#i',
                '$1host.docker.internal',
                $targetUrl
            );
        }

        return $targetUrl;
    }

    private function normalizeToken(string $targetToken): string
    {
        $token = trim($targetToken);
        if (str_starts_with(strtolower($token), 'bearer ')) {

View on GitHub (pinned to 70b9acc424)

When it happens

Trigger: Thrown at app/Services/ServerTransfer/ServerTransferMigrator.php:98 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/d1233f274cbf5311. Report an issue: GitHub.