{"record":{"id":"3b9cdf562f88382d","repo":"coollabsio/coolify","slug":"the-coolify-host-localhost-cannot-be-transferred-3b9cdf","errorCode":null,"errorMessage":"The Coolify host (localhost) cannot be transferred.","messagePattern":"The Coolify host \\(localhost\\) cannot be transferred\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Livewire/Server/Transfer.php","lineNumber":76,"sourceCode":"\n    public function getTransferStatusProperty(): ?string\n    {\n        return data_get($this->server->fresh()->server_metadata, 'transfer.status');\n    }\n\n    public function getIsLocalhostProperty(): bool\n    {\n        return (int) $this->server->id === 0;\n    }\n\n    public function migrateServer(ServerTransferMigrator $migrator): void\n    {\n        $this->ensureDevelopmentAvailability();\n\n        try {\n            $this->authorize('update', $this->server);\n            if ($this->isLocalhost) {\n                throw new \\RuntimeException('The Coolify host (localhost) cannot be transferred.');\n            }\n\n            $result = $migrator->migrate(\n                server: $this->server,\n                targetUrl: $this->targetUrl,\n                targetToken: $this->targetToken,\n                writeRemote: $this->writeRemote,\n            );\n\n            $this->server->refresh();\n            $this->exportId = $result['export_id'] ?? $this->exportId;\n            $this->lastWarnings = array_values((array) data_get($result, 'warnings', []));\n            // Never echo the target token in the result dump.\n            $safe = $result;\n            unset($safe['target_token']);\n            $this->lastResultJson = json_encode($safe, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);\n            $this->targetToken = '';\n            $this->dispatch('success', $result['message'] ?? 'Server transferred.');","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Server/Transfer.php#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Transfer remote servers only - select a server with id != 0 on the Transfer screen","To move the whole Coolify instance, use an instance-level migration (backup/restore of the Coolify host), not server transfer","In automation, skip the sentinel: where('id', '!=', 0) or check getIsLocalhostProperty() before invoking migrate"],"exampleFix":"// before\n$this->migrateServer($migrator); // invoked on the localhost server\n\n// after\nif ((int) $this->server->id !== 0) {\n    $this->migrateServer($migrator);\n} else {\n    $this->dispatch('error', 'The Coolify host (localhost) cannot be transferred.');\n}","handlingStrategy":"validation","validationCode":"if ((int) $server->id === 0) {\n    // localhost sentinel: block the transfer action in the UI\n}","typeGuard":"/** @param mixed $server */\nfunction isTransferableServer($server): bool\n{\n    return $server instanceof \\App\\Models\\Server && (int) $server->id !== 0;\n}","tryCatchPattern":"Catch \\RuntimeException around the migrate call and surface the message; do not retry - id 0 is a structural guard, not a transient condition.","preventionTips":["Filter sentinel rows out of automation: where('id', '!=', 0)","Hide the Transfer screen (or its button) for the localhost server","Use instance backup/restore, not server transfer, to move the Coolify host itself"],"tags":["server","transfer","localhost","sentinel-id-zero"],"backgroundTag":"protected-resource-operation","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}