{"record":{"id":"c716483105586375","repo":"coollabsio/coolify","slug":"docker-compose-file-not-found-at-workdir-compose","errorCode":null,"errorMessage":"Docker Compose file not found at: $workdir$composeFile (branch: {$this->git_branch})<br><br>Check if you used the right extension (.yaml or .yml) in the compose file name.","messagePattern":"Docker Compose file not found at: \\$workdir\\$composeFile \\(branch: (.+?)\\)<br><br>Check if you used the right extension \\(\\.yaml or \\.yml\\) in the compose file name\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Models/Application.php","lineNumber":2166,"sourceCode":"                \"cd /tmp/{$uuid}\",\n                $cloneCommand,\n                'cd checkout',\n                'git sparse-checkout init --cone',\n                \"git sparse-checkout set {$fileList->implode(' ')}\",\n                'git read-tree -mu HEAD',\n                \"cat .$workdir$composeFile\",\n            ]);\n        }\n        try {\n            $composeFileContent = instant_remote_process($commands, $this->destination->server);\n        } catch (\\Exception $e) {\n            // Restore original values on failure only\n            $this->docker_compose_location = $initialDockerComposeLocation;\n            $this->base_directory = $initialBaseDirectory;\n            $this->save();\n\n            if (str($e->getMessage())->contains('No such file')) {\n                throw new RuntimeException(\"Docker Compose file not found at: $workdir$composeFile (branch: {$this->git_branch})<br><br>Check if you used the right extension (.yaml or .yml) in the compose file name.\");\n            }\n            if (str($e->getMessage())->contains('fatal: repository') && str($e->getMessage())->contains('does not exist')) {\n                if ($this->deploymentType() === 'deploy_key') {\n                    throw new RuntimeException('Your deploy key does not have access to the repository. Please check your deploy key and try again.');\n                }\n                throw new RuntimeException('Repository does not exist. Please check your repository URL and try again.');\n            }\n            throw new RuntimeException('Failed to read the Docker Compose file from the repository.');\n        } finally {\n            // Cleanup only - restoration happens in catch block\n            $commands = collect([\n                \"rm -rf /tmp/{$uuid}\",\n            ]);\n            instant_remote_process($commands, $this->destination->server, false);\n        }\n        if ($composeFileContent) {\n            $this->docker_compose_raw = $composeFileContent;\n            $this->save();","sourceCodeStart":2148,"sourceCodeEnd":2184,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Models/Application.php#L2148-L2184","documentation":"While reading the compose file from a fresh shallow clone, Coolify cats '.{base_directory}{docker_compose_location}' on the server. The remote command fails with 'No such file' — the path/branch/extension combination does not exist in the cloned checkout — and Coolify translates it into this actionable RuntimeException (restoring the previously saved location fields first).","triggerScenarios":"docker_compose_location points at a file that is not on the configured git branch; base_directory wrong (file at repo root but '/subdir' configured); extension mismatch (.yaml configured, file is .yml); file name typo; file not committed or gitignored.","commonSituations":"Composing path like '/docker-compose.prod.yml' while the repo only has docker-compose.yml; branch switched from main to a branch lacking the file; case-sensitive filesystem vs 'Docker-Compose.yaml'; new file pushed to wrong branch.","solutions":["Set base directory and Docker Compose file location in the application's source settings to exactly match the repo layout (verify with git ls-tree on the configured branch).","Check the extension: use .yaml or .yml exactly as committed.","Confirm the file exists on the configured git branch and is actually committed (not gitignored).","Push the file or switch the tracked branch, then reload the compose in Coolify."],"exampleFix":"# before: repo has compose at repo root\n$application->base_directory = '/';\n$application->docker_compose_location = '/docker-compose.yaml';\n\n# after: match the real path\n$application->base_directory = '/deploy';\n$application->docker_compose_location = '/compose.yml';","handlingStrategy":"validation","validationCode":"// Verify the file exists on the tracked branch before saving the path\n$files = instant_remote_process([\n    \"git ls-remote --heads {$repoUrl} {$branch} && echo OK\",\n], $server);\n// or after a shallow clone:\n$exists = instant_remote_process([\"test -f ./{$baseDir}{$composeLocation} && echo yes || echo no\"], $server);\nif ($exists === 'no') { /* reject the location fields */ }","typeGuard":null,"tryCatchPattern":"catch (RuntimeException $e) { if (str_contains($e->getMessage(), 'Docker Compose file not found')) { prompt for corrected base directory / compose location / branch; restore-and-retry once after fix; } else { throw $e; } }","preventionTips":["Mirror the exact repo path (case-sensitive) including .yml/.yaml extension in the settings.","When switching branches, re-verify the compose path exists on the new branch.","Add a CI check that the configured compose path exists on the deploy branch."],"tags":["docker-compose","git","file-not-found","coolify"],"backgroundTag":"compose-file-not-found","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}