coollabsio/coolify · error · Exception

Destination not found.

Error message

Destination not found.

What it means

When creating a service from a pasted docker-compose file, the destination UUID is taken from the query string and resolved against the current team's destinations via find_resource_destination_for_current_team(). A null result throws before the Service row is created, so no half-configured service is left behind.

Source

Thrown at app/Livewire/Project/New/DockerCompose.php:52

    {
        try {
            $this->authorize('create', Service::class);

            $this->validate([
                'dockerComposeRaw' => 'required',
            ]);
            $this->dockerComposeRaw = Yaml::dump(Yaml::parse($this->dockerComposeRaw), 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);

            // Validate for command injection BEFORE saving to database
            validateDockerComposeForInjection($this->dockerComposeRaw);

            $project = Project::ownedByCurrentTeam()->where('uuid', $this->parameters['project_uuid'])->firstOrFail();
            $environment = $project->environments()->where('uuid', $this->parameters['environment_uuid'])->firstOrFail();

            $destination_uuid = $this->query['destination'] ?? null;
            $destination = find_resource_destination_for_current_team($destination_uuid);
            if (! $destination) {
                throw new \Exception('Destination not found.');
            }
            $destination_class = $destination->getMorphClass();

            $service = new Service([
                'docker_compose_raw' => $this->dockerComposeRaw,
                'environment_id' => $environment->id,
                'server_id' => $destination->server_id,
                'destination_id' => $destination->id,
                'destination_type' => $destination_class,
            ]);
            $service->save();

            $variables = parseEnvFormatToArray($this->envFile);
            foreach ($variables as $key => $data) {
                // Extract value and comment from parsed data
                // Handle both array format ['value' => ..., 'comment' => ...] and plain string values
                $value = is_array($data) ? ($data['value'] ?? '') : $data;
                $comment = is_array($data) ? ($data['comment'] ?? null) : null;

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Re-enter the flow from the project's environment page so the destination query parameter is regenerated
  2. Verify the destination still exists under the team's servers before pasting the compose file
  3. Re-create the destination network if it was removed unintentionally
Defensive patterns

Strategy: validation

Validate before calling

// validate the query param before building the Service
$destination = find_resource_destination_for_current_team($request->query('destination'));
if (! $destination) {
    abort(404, 'Unknown destination - reopen this page from the environment view.');
}

Type guard

function destinationUuidResolvesForTeam(?string $uuid): bool
{
    return $uuid !== null && find_resource_destination_for_current_team($uuid) !== null;
}

Prevention

When it happens

Trigger: Opening the 'new docker-compose' page with a ?destination= UUID that is deleted, mistyped, or belongs to another team; a bookmarked or stale link from before a destination (or its server) was removed.

Common situations: Bookmarked URLs carrying an old destination param; destination server deleted; switching teams while keeping an old link; manual edits to the URL.

Related errors


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