coollabsio/coolify · error · RuntimeException

The Coolify host (localhost) cannot be transferred.

Error message

The Coolify host (localhost) cannot be transferred.

What it means

migrateServer() on the server Transfer screen refuses to transfer when getIsLocalhostProperty() is true, i.e. (int) $this->server->id === 0 - the seeded 'localhost' sentinel row that represents the machine running the Coolify control plane itself. Self-transfer is unsupported because the instance would be asked to export and rewrite its own database/services, so the guard aborts before ServerTransferMigrator runs.

Source

Thrown at app/Livewire/Server/Transfer.php:76

    public function getTransferStatusProperty(): ?string
    {
        return data_get($this->server->fresh()->server_metadata, 'transfer.status');
    }

    public function getIsLocalhostProperty(): bool
    {
        return (int) $this->server->id === 0;
    }

    public function migrateServer(ServerTransferMigrator $migrator): void
    {
        $this->ensureDevelopmentAvailability();

        try {
            $this->authorize('update', $this->server);
            if ($this->isLocalhost) {
                throw new \RuntimeException('The Coolify host (localhost) cannot be transferred.');
            }

            $result = $migrator->migrate(
                server: $this->server,
                targetUrl: $this->targetUrl,
                targetToken: $this->targetToken,
                writeRemote: $this->writeRemote,
            );

            $this->server->refresh();
            $this->exportId = $result['export_id'] ?? $this->exportId;
            $this->lastWarnings = array_values((array) data_get($result, 'warnings', []));
            // Never echo the target token in the result dump.
            $safe = $result;
            unset($safe['target_token']);
            $this->lastResultJson = json_encode($safe, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
            $this->targetToken = '';
            $this->dispatch('success', $result['message'] ?? 'Server transferred.');

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Transfer remote servers only - select a server with id != 0 on the Transfer screen
  2. To move the whole Coolify instance, use an instance-level migration (backup/restore of the Coolify host), not server transfer
  3. In automation, skip the sentinel: where('id', '!=', 0) or check getIsLocalhostProperty() before invoking migrate

Example fix

// before
$this->migrateServer($migrator); // invoked on the localhost server

// after
if ((int) $this->server->id !== 0) {
    $this->migrateServer($migrator);
} else {
    $this->dispatch('error', 'The Coolify host (localhost) cannot be transferred.');
}
Defensive patterns

Strategy: validation

Validate before calling

if ((int) $server->id === 0) {
    // localhost sentinel: block the transfer action in the UI
}

Type guard

/** @param mixed $server */
function isTransferableServer($server): bool
{
    return $server instanceof \App\Models\Server && (int) $server->id !== 0;
}

Try / catch

Catch \RuntimeException around the migrate call and surface the message; do not retry - id 0 is a structural guard, not a transient condition.

Prevention

When it happens

Trigger: Opening the Transfer screen for the built-in localhost server (id 0) and clicking migrate; scripts or tests invoking the migrate action against server id 0; manually navigating to /server/0/transfer.

Common situations: Exploring the UI and trying to move every server; attempting to relocate the Coolify instance itself to new hardware; automation that iterates all servers including the sentinel.

Related errors


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