{"record":{"id":"e3201c2066c9aea7","repo":"languagetool-org/languagetool","slug":"https-server-start-failed-unknown-reason","errorCode":null,"errorMessage":"https_server_start_failed_unknown_reason","messagePattern":"https_server_start_failed_unknown_reason","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPSServer.java","lineNumber":85,"sourceCode":"      }\n      SSLContext sslContext = getSslContext(config.getKeystore(), config.getKeyStorePassword());\n      HttpsConfigurator configurator = getConfigurator(sslContext);\n      ((HttpsServer)server).setHttpsConfigurator(configurator);\n      RequestLimiter limiter = getRequestLimiterOrNull(config);\n      ErrorRequestLimiter errorLimiter = getErrorRequestLimiterOrNull(config);\n      executorService = getExecutorService(config);\n      BlockingQueue<Runnable> workQueue = executorService.getQueue();\n      httpHandler = new LanguageToolHttpHandler(config, allowedIps, runInternally, limiter, errorLimiter, workQueue, this);\n      server.createContext(\"/\", httpHandler);\n      server.setExecutor(executorService);\n    } catch (BindException e) {\n      ResourceBundle messages = JLanguageTool.getMessageBundle();\n      String message = Tools.i18n(messages, \"https_server_start_failed\", host, Integer.toString(port));\n      throw new PortBindingException(message, e);\n    } catch (Exception e) {\n      ResourceBundle messages = JLanguageTool.getMessageBundle();\n      String message = Tools.i18n(messages, \"https_server_start_failed_unknown_reason\", host, Integer.toString(port));\n      throw new RuntimeException(message, e);\n    }\n  }\n\n  private SSLContext getSslContext(File keyStoreFile, String passPhrase) {\n    try (FileInputStream keyStoreStream = new FileInputStream(keyStoreFile)) {\n      KeyStore keystore = KeyStore.getInstance(\"JKS\");\n      keystore.load(keyStoreStream, passPhrase.toCharArray());\n      KeyManagerFactory kmf = KeyManagerFactory.getInstance(\"SunX509\");\n      kmf.init(keystore, passPhrase.toCharArray());\n      TrustManagerFactory tmf = TrustManagerFactory.getInstance(\"SunX509\");\n      tmf.init(keystore);\n      SSLContext sslContext = SSLContext.getInstance(\"TLS\");\n      sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);\n      return sslContext;\n    } catch (Exception e) {\n      throw new RuntimeException(\"Could not set up SSL context\", e);\n    }\n  }","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPSServer.java#L67-L103","documentation":"The generic catch-all in HTTPSServer's constructor: any exception during server setup that is not a BindException is rethrown as a RuntimeException with the localized 'https_server_start_failed_unknown_reason' message. It indicates HTTPS server initialization failed for an unexpected reason.","triggerScenarios":"Any non-bind failure during HTTPSServer construction: SSL/keystore problems, invalid config values, IO errors creating the listener, executor setup failures — anything except BindException.","commonSituations":"Keystore file missing or corrupt; wrong keystore password; insufficient privileges; misconfigured host string; earlier setup step throwing (check the wrapped cause 'e' for the real reason).","solutions":["Inspect the exception's cause (the wrapped 'e') for the real root cause.","Verify keystore path, format (JKS) and password in the config property file.","Validate the host/port configuration values.","Check the server log output from startup for the stack trace preceding this message."],"exampleFix":"// before\nkeystore = /etc/ssl/wrong.jks\npassword = notthepassword\n// after\nkeystore = /etc/ssl/server.jks\npassword = correctPassword","handlingStrategy":"try-catch","validationCode":"// sanity-check prerequisites before startup\nif (!new File(keystorePath).canRead()) throw new IllegalStateException(\"keystore unreadable: \" + keystorePath);\nif (port <= 0) throw new IllegalStateException(\"invalid port\");","typeGuard":null,"tryCatchPattern":"try {\n  httpsServer = new HTTPSServer(config, false, host, allowedIps);\n} catch (RuntimeException e) {\n  log.error(\"HTTPS startup failed: {}\", e.getCause(), e); // always inspect cause\n}","preventionTips":["Always log/read getCause() — this message hides the real reason","Pre-validate keystore path, format and password before launch","Test server startup in CI with the production property file"],"tags":["server-startup","https","unknown-error"],"backgroundTag":"module-init-failed","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}