{"record":{"id":"b9aeb614b833fc57","repo":"hasura/graphql-engine","slug":"cannot-create-console-server-w","errorCode":null,"errorMessage":"cannot create console server: %w","messagePattern":"cannot create console server: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/pkg/console/serve.go","lineNumber":38,"sourceCode":"\tDontOpenBrowser bool\n\tBrowser         string\n\tConsolePort     string\n\tAPIPort         string\n\tAddress         string\n\n\tSignalChanAPIServer     chan os.Signal\n\tSignalChanConsoleServer chan os.Signal\n}\n\n// Server console and API Server.\nfunc Serve(opts *ServeOpts) error {\n\tvar op errors.Op = \"console.Serve\"\n\t// get HTTP servers\n\tapiHTTPServer := opts.APIServer.GetHTTPServer()\n\n\tconsoleHTTPServer, err := opts.ConsoleServer.GetHTTPServer()\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"cannot create console server: %w\", err))\n\t}\n\n\tgo func() {\n\t\t<-opts.SignalChanAPIServer\n\n\t\terr := apiHTTPServer.Close()\n\t\tif err != nil {\n\t\t\topts.EC.Logger.Debugf(\"unable to close server running on port %s\", opts.APIPort)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\t<-opts.SignalChanConsoleServer\n\n\t\terr := consoleHTTPServer.Close()\n\t\tif err != nil {\n\t\t\topts.EC.Logger.Debugf(\"unable to close server running on port %s\", opts.ConsolePort)\n\t\t}","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/pkg/console/serve.go#L20-L56","documentation":"console.Serve builds two HTTP servers (API and console UI) via GetHTTPServer; a failure building the console server (bad address, TLS config) is returned as 'cannot create console server'. Unlike the fatal log path, this error is returned to the caller of Serve.","triggerScenarios":"Calling console.Serve (what `hasura console` runs) when ConsoleServer.GetHTTPServer fails — typically an invalid listen address/port or misconfigured TLS material for the console UI server.","commonSituations":"Console address/port already bound or invalid (typo like 'locahost'); TLS cert/key mismatch on the console server; running two consoles on the same port.","solutions":["Check the console address/port flags and free the port (lsof -i :9695)","Fix or remove console TLS options","Use a different --console-port if 9695 is taken","Re-run after the conflicting process exits"],"exampleFix":"# before\nhasura console --console-port 9695   # port in use -> cannot create console server\n\n# after\nhasura console --console-port 9696","handlingStrategy":"validation","validationCode":"// Ensure the console port is free\nln, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%s\", addr, consolePort))\nif err != nil { return fmt.Errorf(\"console port unavailable: %w\", err) }\nln.Close()","typeGuard":null,"tryCatchPattern":"if err := consoleServer.Serve(); err != nil {\n    if strings.Contains(err.Error(), \"cannot create console server\") {\n        // free the port or pass --console-port with another value\n    }\n}","preventionTips":["Check ports 9695/9696 are free before console","Parameterize console/API ports in scripts","Kill stale console processes"],"tags":["console","port-binding","server-startup","hasura"],"backgroundTag":"address-in-use","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}