coollabsio/coolify · warning · Exception

Network already added to this server.

Error message

Network already added to this server.

What it means

When creating a Docker destination for a Swarm server, Coolify refuses duplicate network names per server: it checks selectedServer->swarmDockers() for the same network name and throws before creating the SwarmDocker row.

Source

Thrown at app/Livewire/Destination/New/Docker.php:82

        }
        $this->generateName();
    }

    public function generateName(): void
    {
        $name = data_get($this->selectedServer, 'name', new_public_id());
        $this->name = str("{$name}-{$this->network}")->kebab();
    }

    public function submit(): mixed
    {
        try {
            $this->authorize('create', $this->isSwarm ? SwarmDocker::class : StandaloneDocker::class);
            $this->validate();
            if ($this->isSwarm) {
                $found = $this->selectedServer->swarmDockers()->where('network', $this->network)->first();
                if ($found) {
                    throw new \Exception('Network already added to this server.');
                } else {
                    $docker = SwarmDocker::create([
                        'name' => $this->name,
                        'network' => $this->network,
                        'server_id' => $this->selectedServer->id,
                    ]);
                }
            } else {
                $found = $this->selectedServer->standaloneDockers()->where('network', $this->network)->first();
                if ($found) {
                    throw new \Exception('Network already added to this server.');
                } else {
                    $docker = StandaloneDocker::create([
                        'name' => $this->name,
                        'network' => $this->network,
                        'server_id' => $this->selectedServer->id,
                    ]);
                }

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Choose a different network name (e.g. append a suffix)
  2. If the destination already exists, open it from the destination list instead of creating a new one
  3. Refresh the page to clear stale form state and re-check
Defensive patterns

Strategy: validation

Validate before calling

// check before opening the form / before submit
$exists = $server->swarmDockers()->where('network', $network)->exists();
if ($exists) {
    // prefill a unique name: $network .= '-'.Str::random(3);
}

Type guard

function networkIsFreeOnServer($server, string $network): bool
{
    return $server->swarmDockers()->where('network', $network)->doesntExist();
}

Prevention

When it happens

Trigger: Submitting a network name that already exists as a Swarm destination on the selected server - e.g. the default `coolify` network registered during onboarding, or re-submitting a network added in another tab.

Common situations: Re-adding the default network; stale form state after a previous submit; multiple admins adding networks concurrently.

Related errors


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