languagetool-org/languagetool · critical · RuntimeException

Could not start LanguageTool HTTP server on , port

Error message

Could not start LanguageTool HTTP server on , port 

What it means

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.

Source

Thrown at languagetool-server/src/main/java/org/languagetool/server/HTTPServer.java:184

      printCommonConfigFileOptions();
      printCommonOptions();
      System.exit(1);
    }
    HTTPServerConfig config = new HTTPServerConfig(args);
    DatabaseAccess.init(config);
    try {
      checkForNonRootUser();
      HTTPServer server;
      if (config.isPublicAccess()) {
        ServerTools.print("WARNING: running in HTTP mode, consider running LanguageTool behind a reverse proxy that takes care of encryption (HTTPS)");
        ServerTools.print("WARNING: running in public mode, LanguageTool API can be accessed without restrictions!");
        server = new HTTPServer(config, false, null, null);
      } else {
        server = new HTTPServer(config, false, DEFAULT_HOST, DEFAULT_ALLOWED_IPS);
      }
      server.run();
    } catch (Exception e) {
      throw new RuntimeException("Could not start LanguageTool HTTP server on " + DEFAULT_HOST + ", port " + config.getPort(), e);
    }
  }

  @Override
  protected String getProtocol() {
    return "http";
  }

}

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Read the 'Caused by' of the RuntimeException stack trace for the root cause
  2. Free the configured port or choose another one if the cause is a bind failure
  3. Validate the config file and CLI arguments before startup
  4. Run with sufficient permissions and confirm the host/interface (DEFAULT_HOST) is bindable

Example fix

// before
throw new RuntimeException("Could not start LanguageTool HTTP server on " + DEFAULT_HOST + ", port " + config.getPort(), e);
// after (diagnose via cause)
try { server.run(); } catch (RuntimeException e) { e.getCause().printStackTrace(); }
Defensive patterns

Strategy: try-catch

Try / catch

try { httpServerMain(args); } catch (RuntimeException e) {
  Throwable cause = e.getCause();
  log.error("LT server failed to start on {}:{} -> {}", host, port, cause == null ? e : cause);
}

Prevention

When it happens

Trigger: 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.

Common situations: Port already occupied by another service; insufficient privileges to bind; malformed config file; previous wrapped errors 320/321 surfaced through this wrapper.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/91fb7488f8a9a216. Report an issue: GitHub.