{"record":{"id":"8ebcb57ff90f4748","repo":"coollabsio/coolify","slug":"a-server-with-this-ip-domain-is-already-in-use-by","errorCode":null,"errorMessage":"A server with this IP/Domain is already in use by another team.","messagePattern":"A server with this IP/Domain is already in use by another team\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Livewire/Server/Show.php","lineNumber":248,"sourceCode":"            ->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;\n            $this->server->settings->is_metrics_enabled = $this->isMetricsEnabled;\n            $this->server->settings->sentinel_token = $this->sentinelToken;\n            $this->server->settings->sentinel_metrics_refresh_rate_seconds = $this->sentinelMetricsRefreshRateSeconds;","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Server/Show.php#L230-L266","documentation":"Same uniqueness probe in Server Show's syncData(), but the conflicting row belongs to a different team (foundServer->team_id !== currentTeam()->id). The check is a global query across teams, not team-scoped, so an IP registered by any other Coolify team blocks reuse - reflecting that the shared host is already managed elsewhere. The submitted IP is reverted before the exception propagates.","triggerScenarios":"Two teams on the same Coolify instance (or cloud) trying to register the same host; a server transferred from another team leaving the old row behind; trying to manage a host already managed by a different account.","commonSituations":"Shared/VPS hosts claimed by a previous organization account; leftover rows after a failed server transfer; consultants re-adding a client box under a new team.","solutions":["Have the other team release the server (delete it there) before registering it here","Use a distinct IP/hostname that reaches the box (e.g. a DNS name instead of the raw IP) if you own the host","If the row is a leftover from a transfer you control, remove it in the source team and retry","Contact the instance administrator for cross-team cleanup on managed instances"],"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) {\n    $this->server->ip = $this->ip;\n} else {\n    $this->dispatch('error', $found->team_id === currentTeam()->id\n        ? 'A server with this IP/Domain already exists in your team.'\n        : 'A server with this IP/Domain is already in use by another team.');\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    // the IP is owned by another team - coordinate release or use another hostname\n}","typeGuard":null,"tryCatchPattern":"Catch \\Exception in submit and dispatch('error', $e->getMessage()); do not retry the same IP - cross-team collisions need the other row removed or a different hostname.","preventionTips":["Release servers in the old team before registering them in a new one","Prefer unique DNS names per managing team when a host is shared","Ask the instance admin to purge stale cross-team rows on managed instances"],"tags":["server","uniqueness","validation","multi-tenant"],"backgroundTag":"duplicate-unique-constraint","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}