{"record":{"id":"aacc7f2ffcd53127","repo":"louislam/dockge","slug":"failed-to-down-please-check-the-terminal-output-f","errorCode":null,"errorMessage":"Failed to down, please check the terminal output for more information.","messagePattern":"Failed to down, please check the terminal output for more information\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"backend/stack.ts","lineNumber":452,"sourceCode":"            throw new Error(\"Failed to stop, please check the terminal output for more information.\");\n        }\n        return exitCode;\n    }\n\n    async restart(socket: DockgeSocket) : Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"restart\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to restart, please check the terminal output for more information.\");\n        }\n        return exitCode;\n    }\n\n    async down(socket: DockgeSocket) : Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"down\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to down, please check the terminal output for more information.\");\n        }\n        return exitCode;\n    }\n\n    async update(socket: DockgeSocket) {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"pull\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to pull, please check the terminal output for more information.\");\n        }\n\n        // If the stack is not running, we don't need to restart it\n        await this.updateStatus();\n        log.debug(\"update\", \"Status: \" + this.status);\n        if (this.status !== RUNNING) {\n            return exitCode;\n        }\n","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/louislam/dockge/blob/f809ae192b571944ad773e9866d3e67064ae8043/backend/stack.ts#L434-L470","documentation":"Stack.down() runs 'docker compose down' (without --remove-orphans) and throws this Error when it exits non-zero; cause is shown in the compose terminal. down stops and removes containers/networks defined by the compose project.","triggerScenarios":"compose down exits non-zero: daemon unreachable, containers in dead state, network removal failure (network in use by containers outside the project), compose project metadata missing.","commonSituations":"Host OOM or disk full during teardown; externally-created network attached to project containers; daemon restarting; mixing manual docker commands with Dockge leaving orphaned attachments.","solutions":["Read the compose terminal output for the exact error","Check docker daemon health (docker info / systemctl status docker)","Detach foreign containers from the project network or remove the network manually (docker network rm)","Force-remove stuck containers (docker rm -f) then retry down","Free disk space if the host is full — teardown writes/removes metadata"],"exampleFix":"// before\nawait stack.down(socket);\n// after\ntry {\n    await stack.down(socket);\n} catch (e) {\n    log.error(\"down\", `Down failed for '${stack.name}'; inspect terminal, then clean up networks/containers manually if needed`);\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"function daemonReachable(): boolean {\n    try { execSync(\"docker info\"); return true; } catch { return false; }\n}\nif (!daemonReachable()) {\n    throw new Error(\"Docker daemon unreachable — down will fail\");\n}\nawait stack.down(socket);","typeGuard":"function downOk(exitCode: number | undefined): boolean {\n    return exitCode === 0;\n}","tryCatchPattern":"try {\n    await stack.down(socket);\n} catch (e) {\n    log.error(\"down\", \"Down failed — read terminal output; detach foreign network users, rm -f stuck containers, then retry\");\n    throw e;\n}","preventionTips":["Don't attach external containers to stack networks","Keep disk space available for teardown operations","Check daemon health before bulk down operations","Prefer Dockge's delete (down --remove-orphans) over manual cleanup"],"tags":["docker","docker-compose","teardown","terminal"],"backgroundTag":"docker-compose-down-failed","analyzedSha":"f809ae192b571944ad773e9866d3e67064ae8043","analyzedAt":"2026-08-31T19:13:50.919Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}