{"record":{"id":"d1233f274cbf5311","repo":"coollabsio/coolify","slug":"a-valid-target-instance-url-is-required-e-g-http","errorCode":null,"errorMessage":"A valid target instance URL is required (e.g. http://localhost:8001).","messagePattern":"A valid target instance URL is required \\(e\\.g\\. http://localhost:8001\\)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Services/ServerTransfer/ServerTransferMigrator.php","lineNumber":98,"sourceCode":"            );\n        }\n\n        return [\n            'server_uuid' => $server->uuid,\n            'export_id' => is_string($exportId) ? $exportId : null,\n            'target_url' => $targetUrl,\n            'import' => $importBody,\n            'complete' => $complete,\n            'warnings' => $warnings,\n            'message' => 'Server migrated to '.$targetUrl.'. Automations disabled on this instance.',\n        ];\n    }\n\n    private function normalizeTargetUrl(string $targetUrl): string\n    {\n        $targetUrl = rtrim(trim($targetUrl), '/');\n        if ($targetUrl === '' || ! filter_var($targetUrl, FILTER_VALIDATE_URL)) {\n            throw new RuntimeException('A valid target instance URL is required (e.g. http://localhost:8001).');\n        }\n\n        // From inside Docker, localhost is this container — use the host gateway for peer instances.\n        if (file_exists('/.dockerenv') || is_file('/run/.containerenv')) {\n            $targetUrl = (string) preg_replace(\n                '#^(https?://)(localhost|127\\.0\\.0\\.1)(?=[:/]|$)#i',\n                '$1host.docker.internal',\n                $targetUrl\n            );\n        }\n\n        return $targetUrl;\n    }\n\n    private function normalizeToken(string $targetToken): string\n    {\n        $token = trim($targetToken);\n        if (str_starts_with(strtolower($token), 'bearer ')) {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Services/ServerTransfer/ServerTransferMigrator.php#L80-L116","documentation":"Error \"A valid target instance URL is required (e.g. http://localhost:8001).\" thrown in coollabsio/coolify.","triggerScenarios":"Thrown at app/Services/ServerTransfer/ServerTransferMigrator.php:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}