coollabsio/coolify · error · RuntimeException

A target instance API token is required (root or write + cre

Error message

A target instance API token is required (root or write + create servers).

What it means

Error "A target instance API token is required (root or write + create servers)." thrown in coollabsio/coolify.

Source

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

        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 ')) {
            $token = trim(substr($token, 7));
        }
        if ($token === '') {
            throw new RuntimeException('A target instance API token is required (root or write + create servers).');
        }

        return $token;
    }

    /**
     * @param  array<string, mixed>  $bundle
     * @return array<string, mixed>
     */
    private function postImportToTarget(
        string $targetUrl,
        string $token,
        array $bundle,
        bool $writeRemote,
        bool $rebindSentinel,
        bool $preserveUuids,
        bool $adoptMode,
    ): array {

View on GitHub (pinned to 70b9acc424)

When it happens

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