{"record":{"id":"090cecf28ba958be","repo":"louislam/dockge","slug":"failed-to-start-service-servicename-please-che","errorCode":null,"errorMessage":"Failed to start service ${serviceName}, please check logs for more information.","messagePattern":"Failed to start service (.+?), please check logs for more information\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"backend/stack.ts","lineNumber":558,"sourceCode":"                    } else {\n                        addLine(obj);\n                    }\n                } catch (e) {\n                }\n            }\n\n            return statusList;\n        } catch (e) {\n            log.error(\"getServiceStatusList\", e);\n            return statusList;\n        }\n    }\n\n    async startService(socket: DockgeSocket, serviceName: string) {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        const exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", [ \"compose\", \"up\", \"-d\", serviceName ], this.path);\n        if (exitCode !== 0) {\n            throw new Error(`Failed to start service ${serviceName}, please check logs for more information.`);\n        }\n\n        return exitCode;\n    }\n\n    async stopService(socket: DockgeSocket, serviceName: string): Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        const exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", [ \"compose\", \"stop\", serviceName ], this.path);\n        if (exitCode !== 0) {\n            throw new Error(`Failed to stop service ${serviceName}, please check logs for more information.`);\n        }\n\n        return exitCode;\n    }\n\n    async restartService(socket: DockgeSocket, serviceName: string): Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        const exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", [ \"compose\", \"restart\", serviceName ], this.path);","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/louislam/dockge/blob/f809ae192b571944ad773e9866d3e67064ae8043/backend/stack.ts#L540-L576","documentation":"Stack.startService() runs `docker compose up -d <serviceName>` in the stack directory via a terminal. A non-zero exit code means docker failed to create/start that single service, so the method throws this template error naming the service. Like other stack errors, the diagnostic detail is in the terminal stream, not in the exception message.","triggerScenarios":"Invoking the start-service socket action for a service whose `docker compose up -d <name>` exits non-zero — e.g. unknown service name in compose file, build failure, pull failure, port conflict, or dependency service failed to start.","commonSituations":"Typo'd service name sent from the UI after the compose file was edited; image tag no longer exists in the registry; container name or host port already in use; service depends_on a service that fails.","solutions":["Check the terminal output in Dockge for the docker error for that service","Verify the service name exists: `docker compose config --services` in the stack dir","Run `docker compose up -d <service>` manually to see the full error","Fix the underlying cause (port conflict, bad image, build error) and retry"],"exampleFix":"// before\nawait stack.startService(socket, \"web\"); // throws if 'web' doesn't exist\n// after\nconst services = await listComposeServices(stack.path);\nif (services.includes(\"web\")) {\n  await stack.startService(socket, \"web\");\n}","handlingStrategy":"validation","validationCode":"const services = (await exec(`docker compose -f ${stack.path}/compose.yml config --services`)).stdout.split(/\\s+/).filter(Boolean);\nif (!services.includes(serviceName)) {\n  throw new Error(`Service '${serviceName}' not in compose file`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await stack.startService(socket, serviceName);\n} catch (e) {\n  if (e.message.startsWith(\"Failed to start service\")) {\n    console.error(`start failed for ${serviceName}; see terminal output`, e);\n  } else throw e;\n}","preventionTips":["List services with `docker compose config --services` before referencing one","Keep the UI service list in sync after editing compose.yml","Pre-pull images (`docker compose pull`) to catch tag/registry problems early","Check for host port conflicts before starting services"],"tags":["docker","docker-compose","service-start","exit-code"],"backgroundTag":"docker-compose-service-start-failed","analyzedSha":"f809ae192b571944ad773e9866d3e67064ae8043","analyzedAt":"2026-08-31T19:13:50.919Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}