{"record":{"id":"431963a9d96d0528","repo":"louislam/dockge","slug":"console-is-not-enabled","errorCode":null,"errorMessage":"Console is not enabled.","messagePattern":"Console is not enabled\\.","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"backend/agent-socket-handlers/terminal-socket-handler.ts","lineNumber":43,"sourceCode":"                if (terminal instanceof InteractiveTerminal) {\n                    //log.debug(\"terminalInput\", \"Terminal found, writing to terminal.\");\n                    terminal.write(cmd);\n                } else {\n                    throw new Error(\"Terminal not found or it is not a Interactive Terminal.\");\n                }\n            } catch (e) {\n                callbackError(e, callback);\n            }\n        });\n\n        // Main Terminal\n        agentSocket.on(\"mainTerminal\", async (terminalName : unknown, callback) => {\n            try {\n                checkLogin(socket);\n\n                // Throw an error if console is not enabled\n                if (!server.config.enableConsole) {\n                    throw new ValidationError(\"Console is not enabled.\");\n                }\n\n                // TODO: Reset the name here, force one main terminal for now\n                terminalName = \"console\";\n\n                if (typeof(terminalName) !== \"string\") {\n                    throw new ValidationError(\"Terminal name must be a string.\");\n                }\n\n                log.debug(\"mainTerminal\", \"Terminal name: \" + terminalName);\n\n                let terminal = Terminal.getTerminal(terminalName);\n\n                if (!terminal) {\n                    terminal = new MainTerminal(server, terminalName);\n                    terminal.rows = 50;\n                    log.debug(\"mainTerminal\", \"Terminal created\");\n                }","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/louislam/dockge/blob/f809ae192b571944ad773e9866d3e67064ae8043/backend/agent-socket-handlers/terminal-socket-handler.ts#L25-L61","documentation":"Thrown as a ValidationError in the mainTerminal handler when server.config.enableConsole is false. The console feature is disabled in the server configuration, so the handler refuses to attach a main terminal. This is an intentional configuration gate, not a bug.","triggerScenarios":"Emitting the 'mainTerminal' socket event while the server was started with enableConsole set to false (or omitted and defaulting to disabled) in its config file.","commonSituations":"Deployments that disabled console for security/hardening but still have clients (or old UI sessions) requesting the main terminal; config files copied from environments with different settings.","solutions":["Set enableConsole: true in the server config and restart the server if console access is required.","If console should stay disabled, stop emitting 'mainTerminal' from the client and hide the console UI.","Confirm the server actually loaded the config file you edited (check startup logs/config path).","Ensure clients handle the callback error gracefully and show a 'console disabled' message."],"exampleFix":"// before (server config)\n{ \"enableConsole\": false }\n// after\n{ \"enableConsole\": true }","handlingStrategy":"validation","validationCode":"if (!serverConfig.enableConsole) { disableConsoleUI(); } else { socket.emit(\"mainTerminal\", \"console\", cb); }","typeGuard":"const consoleAvailable = (cfg) => cfg?.enableConsole === true;","tryCatchPattern":"socket.emit(\"mainTerminal\", \"console\", (res) => { if (res?.error) showConsoleDisabledMessage(res.error); });","preventionTips":["Fetch server feature flags before rendering console UI.","Hide/disable console entry points when enableConsole is false.","Keep server config in sync across environments; document the flag.","Handle callback errors so a disabled feature degrades gracefully."],"tags":["configuration","validation","socket-io","terminal"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"f809ae192b571944ad773e9866d3e67064ae8043","analyzedAt":"2026-08-31T19:13:50.919Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}