{"record":{"id":"575c61ec14d455ac","repo":"louislam/dockge","slug":"console-is-not-enabled-575c61","errorCode":null,"errorMessage":"Console is not enabled.","messagePattern":"Console is not enabled\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"backend/terminal.ts","lineNumber":275,"sourceCode":"        this.ptyProcess?.write(input);\n    }\n\n    resetCWD() {\n        const cwd = process.cwd();\n        this.ptyProcess?.write(`cd \"${cwd}\"\\r`);\n    }\n}\n\n/**\n * User interactive terminal that use bash or powershell with limited commands such as docker, ls, cd, dir\n */\nexport class MainTerminal extends InteractiveTerminal {\n    constructor(server : DockgeServer, name : string) {\n        let shell;\n\n        // Throw an error if console is not enabled\n        if (!server.config.enableConsole) {\n            throw new Error(\"Console is not enabled.\");\n        }\n\n        if (os.platform() === \"win32\") {\n            if (commandExistsSync(\"pwsh.exe\")) {\n                shell = \"pwsh.exe\";\n            } else {\n                shell = \"powershell.exe\";\n            }\n        } else {\n            shell = \"bash\";\n        }\n        super(server, name, shell, [], server.stacksDir);\n    }\n\n    public write(input : string) {\n        super.write(input);\n    }\n}","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/louislam/dockge/blob/f809ae192b571944ad773e9866d3e67064ae8043/backend/terminal.ts#L257-L293","documentation":"The MainTerminal constructor in backend/terminal.ts refuses to create the combined/main console terminal unless server.config.enableConsole is true. Dockge disables the shared console by default for security — it grants shell access on the server — so constructing a MainTerminal when the flag is off throws this error immediately, before any shell selection happens.","triggerScenarios":"Any code path (e.g. joining the combined console terminal from the frontend) that instantiates MainTerminal while `enableConsole` is false in the Dockge server config (default), or via --disable-console / console disabled environment.","commonSituations":"Users upgrading Dockge and clicking the console button without knowing the console was disabled; deployments that intentionally disable console for security; reverse-proxy setups where the console endpoint was expected to work.","solutions":["Enable the console by starting Dockge with the console enabled (e.g. remove --disable-console / set enableConsole: true in config)","If the console should stay disabled, do not expose or call the console UI feature","Use per-stack interactive terminals instead of the combined console","Check the Dockge startup flags/environment to confirm the intended console setting"],"exampleFix":"// before (server started with console disabled)\nconst terminal = new MainTerminal(server, name);\n// after (guard on config)\nif (server.config.enableConsole) {\n  const terminal = new MainTerminal(server, name);\n} else {\n  throw new FriendlyError(\"Console is disabled on this Dockge instance.\");\n}","handlingStrategy":"type-guard","validationCode":"// before creating a MainTerminal\nif (!server.config.enableConsole) {\n  // hide the console button / skip the call\n  return;\n}\nconst terminal = new MainTerminal(server, name);","typeGuard":"function consoleAvailable(server) {\n  return typeof server.config?.enableConsole === \"boolean\" && server.config.enableConsole;\n}","tryCatchPattern":"let terminal;\ntry {\n  terminal = new MainTerminal(server, name);\n} catch (e) {\n  if (e.message === \"Console is not enabled.\") {\n    showNotice(\"Console is disabled on this instance. Enable it in the server config.\");\n  } else throw e;\n}","preventionTips":["Check enableConsole in the server config before exposing any console UI","Start Dockge without console-disabling flags if you need the combined terminal","Hide the console feature in the frontend when the server reports it disabled","Remember the console grants full shell access — keep it off on shared hosts unless needed"],"tags":["terminal","configuration","security","console"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"f809ae192b571944ad773e9866d3e67064ae8043","analyzedAt":"2026-08-31T19:13:50.919Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}