{"record":{"id":"c39929e2021ae338","repo":"languagetool-org/languagetool","slug":"timeout-timeout-millis-ms-exhausted-getti","errorCode":null,"errorMessage":"Timeout (\" + TIMEOUT_MILLIS + \"ms) exhausted getting NER results","messagePattern":"Timeout \\(\" \\+ TIMEOUT_MILLIS \\+ \"ms\\) exhausted getting NER results","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/tagging/ner/NERService.java","lineNumber":101,"sourceCode":"  }\n\n  private static String postTo(URL url, String encodedPostData, Map<String, String> properties) {\n    try {\n      Future<?> future = executorService.submit(() -> {\n        URLConnection connection = url.openConnection();\n        for (Map.Entry<String, String> entry : properties.entrySet()) {\n          connection.setRequestProperty(entry.getKey(), entry.getValue());\n        }\n        connection.setDoOutput(true);\n        try (Writer writer = new OutputStreamWriter(connection.getOutputStream(), UTF_8)) {\n          writer.write(encodedPostData);\n          writer.flush();\n          return StringTools.streamToString(connection.getInputStream(), \"UTF-8\");\n        }\n      });\n      return (String) future.get(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);\n    } catch (TimeoutException e) {\n      throw new RuntimeException(\"Timeout (\" + TIMEOUT_MILLIS + \"ms) exhausted getting NER results\", e);\n    } catch (InterruptedException | ExecutionException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  @NotNull\n  List<Span> parseBuffer(String buffer) {\n    String[] values = buffer.trim().split(\" \");\n    if (buffer.trim().contains(\"\\n\")) {\n      logger.warn(\"Got multiple lines to read from external NER, this should not happen: '\" + buffer.trim() + \"'\" );\n    }\n    List<Span> res = new ArrayList<>();\n    for (String value : values) {\n      if (value.isEmpty()) {\n        continue;\n      }\n      int slash3 = getLastSlashFrom(value, value.length()-1);\n      int slash2 = getLastSlashFrom(value, slash3-1);","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/tagging/ner/NERService.java#L83-L119","documentation":"Timeout guard around the HTTP POST to the external NER service: the request task submitted to the executor did not finish within TIMEOUT_MILLIS, so no NER results are available. Fires on slow or unresponsive NER servers (e.g. under load or network issues) — the call fails rather than blocking indefinitely.","triggerScenarios":"Thrown at languagetool-core/src/main/java/org/languagetool/tagging/ner/NERService.java:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the NER service endpoint's health, latency, and network reachability","Increase TIMEOUT_MILLIS if legitimate processing takes longer","Add retry logic or return partial/no-NER results gracefully when the service is slow"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}