{"record":{"id":"c293078cc5a36b70","repo":"coollabsio/coolify","slug":"a-server-with-this-ip-domain-already-exists-in-you","errorCode":null,"errorMessage":"A server with this IP/Domain already exists in your team.","messagePattern":"A server with this IP/Domain already exists in your team\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Livewire/Server/Show.php","lineNumber":245,"sourceCode":"        return collect(timezone_identifiers_list())\n            ->sort()\n            ->values()\n            ->toArray();\n    }\n\n    public function syncData(bool $toModel = false)\n    {\n        if ($toModel) {\n            $this->validate();\n\n            $this->authorize('update', $this->server);\n            $foundServer = Server::where('ip', $this->ip)\n                ->where('id', '!=', $this->server->id)\n                ->first();\n            if ($foundServer) {\n                $this->ip = $this->server->ip;\n                if ($foundServer->team_id === currentTeam()->id) {\n                    throw new \\Exception('A server with this IP/Domain already exists in your team.');\n                }\n\n                throw new \\Exception('A server with this IP/Domain is already in use by another team.');\n            }\n\n            $this->server->name = $this->name;\n            $this->server->description = $this->description;\n            $this->server->ip = $this->ip;\n            $this->server->user = $this->user;\n            $this->server->port = $this->port;\n            $this->server->validation_logs = $this->validationLogs;\n            $this->server->save();\n\n            $this->server->settings->connection_timeout = $this->connectionTimeout;\n            $this->server->settings->is_swarm_manager = $this->isSwarmManager;\n            $this->server->settings->wildcard_domain = $this->wildcardDomain;\n            $this->server->settings->is_swarm_worker = $this->isSwarmWorker;\n            $this->server->settings->is_build_server = $this->isBuildServer;","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Server/Show.php#L227-L263","documentation":"Server Show's syncData(toModel: true) enforces IP uniqueness before saving: Server::where('ip', $this->ip)->where('id', '!=', $this->server->id)->first() found a row, and that row's team_id equals currentTeam()->id. The submitted IP property is reverted to the stored server IP and the save aborts - each team may register a given IP/hostname only once.","triggerScenarios":"Editing a server and typing the IP/hostname of another server already registered in the same team (e.g. pointing two entries at 127.0.0.1 or the same host); re-adding a removed server while the old row still exists; DNS name and IP both registered for the same box.","commonSituations":"Registering both the hostname and the raw IP of one machine; leftovers from a deleted-and-recreated server; import/migration scripts creating duplicate rows.","solutions":["Set a unique IP/hostname for this server and save again","Delete or repurpose the existing server entry in this team that already holds the IP","If you need one machine for multiple purposes, keep a single server entry and use its destinations/resources","Clean up duplicate rows (php artisan tinker or the UI) before re-importing"],"exampleFix":"// before\n$this->server->ip = $this->ip; // no duplicate check\n\n// after\n$found = \\App\\Models\\Server::where('ip', $this->ip)\n    ->where('id', '!=', $this->server->id)->first();\nif (! $found && $this->ip !== $this->server->ip) {\n    $this->server->ip = $this->ip;\n}","handlingStrategy":"validation","validationCode":"$found = \\App\\Models\\Server::where('ip', $this->ip)\n    ->where('id', '!=', $this->server->id)->first();\nif ($found && $found->team_id === currentTeam()->id) {\n    // pick a different IP/hostname before submit\n}","typeGuard":null,"tryCatchPattern":"Catch \\Exception inside syncData's caller (submit) and dispatch the message; the component reverts $this->ip to the stored value on failure - show that reverted value in the form.","preventionTips":["Search the team's server list for the IP before assigning it","Register one machine once - use resources/destinations for multiple workloads","Clean up duplicate rows after re-imports"],"tags":["server","uniqueness","validation","ip"],"backgroundTag":"duplicate-unique-constraint","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}