{"record":{"id":"5d8af318812e60c8","repo":"languagetool-org/languagetool","slug":"ioexception-while-synthesizing-suggestions-verb-n","errorCode":null,"errorMessage":"IOException while synthesizing suggestions (verb-noun agreement)","messagePattern":"IOException while synthesizing suggestions \\(verb-noun agreement\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/uk/src/main/java/org/languagetool/rules/uk/TokenAgreementVerbNounRule.java","lineNumber":407,"sourceCode":"    \n    String requiredPostTagsRegEx = \":(\" + String.join(\"|\", cases) + \")\";\n\n    Set<String> suggestions = new LinkedHashSet<>();\n\n    for (AnalyzedToken analyzedToken: tokenReadings.getReadings()) {\n    \n      String oldPosTag = analyzedToken.getPOSTag();\n      \n      if( oldPosTag == null || ! oldPosTag.contains(\":v_\") )\n        continue;\n      \n      String posTag = oldPosTag.replaceFirst(\":v_[a-z]+\", requiredPostTagsRegEx);\n\n      try {\n        String[] synthesized = synthesizer.synthesize(analyzedToken, posTag, true);\n        suggestions.addAll( Arrays.asList(synthesized) );\n      } catch (IOException e) {\n        throw new RuntimeException(e);\n      }\n    }\n    return new ArrayList<>(suggestions);\n  }\n\n  private String formatInflections(Set<String> cases) {\n    if( cases.isEmpty() )\n      return \"неперех.\";\n    \n    return \"вимагає: \" + cases.stream()\n        .map(c -> PosTagHelper.VIDMINKY_I_MAP.get(c))\n        .collect(Collectors.joining(\", \"));\n  }\n\n}\n","sourceCodeStart":389,"sourceCodeEnd":423,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/uk/src/main/java/org/languagetool/rules/uk/TokenAgreementVerbNounRule.java#L389-L423","documentation":"TokenAgreementVerbNounRule.getSuggestions() (used by the suggestions flow) rewrites the verb posTag and calls synthesizer.synthesize(analyzedToken, posTag, true) to produce agreeing verb forms; IOException is wrapped in RuntimeException. A failure means the Morfologik synthesizer could not read its dictionary while generating verb inflections.","triggerScenarios":"Verb-noun disagreement detected in text; the rule builds inflected verb suggestions and the dictionary-backed synthesize() call throws IOException.","commonSituations":"Corrupted/missing Ukrainian dictionaries in the deployed jar; disk or volume I/O errors; jars damaged by shading/filtering; resource exhaustion during dictionary load.","solutions":["Diagnose the original IOException from the cause chain (resource path, permissions, disk).","Validate and rebuild the language-module jar so dictionary binaries are intact.","Return an empty suggestion list on synthesis failure so the grammar error is still reported.","Add a startup synthesizer smoke test and alert if it fails.","Keep binary dictionary resources out of any resource-filtering in the build."],"exampleFix":"// before\nString[] synthesized = synthesizer.synthesize(analyzedToken, posTag, true);\n// after\nString[] synthesized;\ntry {\n  synthesized = synthesizer.synthesize(analyzedToken, posTag, true);\n} catch (IOException e) {\n  LOG.warn(\"verb synthesis failed; no suggestions\", e);\n  synthesized = new String[0];\n}","handlingStrategy":"try-catch","validationCode":"// startup check\ntry {\n  String[] t = synthesizer.synthesize(new AnalyzedToken(\"бачив\", \"verb:perf:past:m\", \"бачити\"), \"verb:perf:past:f\", true);\n  if (t.length == 0) LOG.warn(\"Verb synthesis returned no forms\");\n} catch (IOException e) { throw new IllegalStateException(\"Verb synthesizer dictionary broken\", e); }","typeGuard":null,"tryCatchPattern":"try { suggestions = rule.getSuggestions(tokens); }\ncatch (RuntimeException e) {\n  if (e.getCause() instanceof IOException) { LOG.warn(\"verb-noun synthesis failed\", e); suggestions = Collections.emptyList(); }\n  else throw e;\n}","preventionTips":["Smoke-test verb synthesis at startup","Keep .dict resources out of build-time filtering","Degrade to reporting the agreement error without inflected suggestions","Pin artifact checksums and verify before deploy"],"tags":["io","synthesizer","verbs","agreement-rule"],"backgroundTag":"file-read-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"}