{"record":{"id":"91fb7488f8a9a216","repo":"languagetool-org/languagetool","slug":"could-not-start-languagetool-http-server-on-port","errorCode":null,"errorMessage":"Could not start LanguageTool HTTP server on , port ","messagePattern":"Could not start LanguageTool HTTP server on , port ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServer.java","lineNumber":184,"sourceCode":"      printCommonConfigFileOptions();\n      printCommonOptions();\n      System.exit(1);\n    }\n    HTTPServerConfig config = new HTTPServerConfig(args);\n    DatabaseAccess.init(config);\n    try {\n      checkForNonRootUser();\n      HTTPServer server;\n      if (config.isPublicAccess()) {\n        ServerTools.print(\"WARNING: running in HTTP mode, consider running LanguageTool behind a reverse proxy that takes care of encryption (HTTPS)\");\n        ServerTools.print(\"WARNING: running in public mode, LanguageTool API can be accessed without restrictions!\");\n        server = new HTTPServer(config, false, null, null);\n      } else {\n        server = new HTTPServer(config, false, DEFAULT_HOST, DEFAULT_ALLOWED_IPS);\n      }\n      server.run();\n    } catch (Exception e) {\n      throw new RuntimeException(\"Could not start LanguageTool HTTP server on \" + DEFAULT_HOST + \", port \" + config.getPort(), e);\n    }\n  }\n\n  @Override\n  protected String getProtocol() {\n    return \"http\";\n  }\n\n}\n\n","sourceCodeStart":166,"sourceCodeEnd":195,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServer.java#L166-L195","documentation":"HTTPServer.main wraps server construction and run() in a try/catch and rethrows any Exception as a RuntimeException 'Could not start LanguageTool HTTP server on <host>, port <port>'. This is a generic wrapper: the causing exception (in the 'cause' field) holds the real reason, e.g. bind failure or invalid config.","triggerScenarios":"Any exception during new HTTPServer(...) or server.run() in main(), most commonly an IOException from port binding (address already in use) or an IllegalArgumentException from invalid configuration.","commonSituations":"Port already occupied by another service; insufficient privileges to bind; malformed config file; previous wrapped errors 320/321 surfaced through this wrapper.","solutions":["Read the 'Caused by' of the RuntimeException stack trace for the root cause","Free the configured port or choose another one if the cause is a bind failure","Validate the config file and CLI arguments before startup","Run with sufficient permissions and confirm the host/interface (DEFAULT_HOST) is bindable"],"exampleFix":"// before\nthrow new RuntimeException(\"Could not start LanguageTool HTTP server on \" + DEFAULT_HOST + \", port \" + config.getPort(), e);\n// after (diagnose via cause)\ntry { server.run(); } catch (RuntimeException e) { e.getCause().printStackTrace(); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { httpServerMain(args); } catch (RuntimeException e) {\n  Throwable cause = e.getCause();\n  log.error(\"LT server failed to start on {}:{} -> {}\", host, port, cause == null ? e : cause);\n}","preventionTips":["Always inspect getCause() — this message is only a wrapper","Pre-check port availability and config validity before launch","Log host/port from config on startup failure for faster diagnosis"],"tags":["server-startup","java","http-server","wrapped-exception"],"backgroundTag":"http-server-start-failed","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}