{"record":{"id":"b66ab36e3a42e466","repo":"coollabsio/coolify","slug":"destination-not-found-b66ab3","errorCode":null,"errorMessage":"Destination not found.","messagePattern":"Destination not found\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Livewire/Project/New/DockerCompose.php","lineNumber":52,"sourceCode":"    {\n        try {\n            $this->authorize('create', Service::class);\n\n            $this->validate([\n                'dockerComposeRaw' => 'required',\n            ]);\n            $this->dockerComposeRaw = Yaml::dump(Yaml::parse($this->dockerComposeRaw), 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);\n\n            // Validate for command injection BEFORE saving to database\n            validateDockerComposeForInjection($this->dockerComposeRaw);\n\n            $project = Project::ownedByCurrentTeam()->where('uuid', $this->parameters['project_uuid'])->firstOrFail();\n            $environment = $project->environments()->where('uuid', $this->parameters['environment_uuid'])->firstOrFail();\n\n            $destination_uuid = $this->query['destination'] ?? null;\n            $destination = find_resource_destination_for_current_team($destination_uuid);\n            if (! $destination) {\n                throw new \\Exception('Destination not found.');\n            }\n            $destination_class = $destination->getMorphClass();\n\n            $service = new Service([\n                'docker_compose_raw' => $this->dockerComposeRaw,\n                'environment_id' => $environment->id,\n                'server_id' => $destination->server_id,\n                'destination_id' => $destination->id,\n                'destination_type' => $destination_class,\n            ]);\n            $service->save();\n\n            $variables = parseEnvFormatToArray($this->envFile);\n            foreach ($variables as $key => $data) {\n                // Extract value and comment from parsed data\n                // Handle both array format ['value' => ..., 'comment' => ...] and plain string values\n                $value = is_array($data) ? ($data['value'] ?? '') : $data;\n                $comment = is_array($data) ? ($data['comment'] ?? null) : null;","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Project/New/DockerCompose.php#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"Bookmarked URLs carrying an old destination param; destination server deleted; switching teams while keeping an old link; manual edits to the URL.","solutions":["Re-enter the flow from the project's environment page so the destination query parameter is regenerated","Verify the destination still exists under the team's servers before pasting the compose file","Re-create the destination network if it was removed unintentionally"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate the query param before building the Service\n$destination = find_resource_destination_for_current_team($request->query('destination'));\nif (! $destination) {\n    abort(404, 'Unknown destination - reopen this page from the environment view.');\n}","typeGuard":"function destinationUuidResolvesForTeam(?string $uuid): bool\n{\n    return $uuid !== null && find_resource_destination_for_current_team($uuid) !== null;\n}","tryCatchPattern":null,"preventionTips":["Always enter the new-service flow from the environment page so the destination param is fresh","Avoid bookmarking deep links that carry destination UUIDs","After deleting a destination or server, purge stale links and re-select from the picker"],"tags":["livewire","docker-compose","destination","service","stale-link"],"backgroundTag":"resource-not-in-scope","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}