{"record":{"id":"fb76ecca94cc7463","repo":"languagetool-org/languagetool","slug":"ioexception-while-synthesizing-suggestions","errorCode":null,"errorMessage":"IOException while synthesizing suggestions (їх -> їхній)","messagePattern":"IOException while synthesizing suggestions \\(їх -> їхній\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/uk/src/main/java/org/languagetool/rules/uk/TokenAgreementPrepNounRule.java","lineNumber":550,"sourceCode":"        state.prepTokenReadings.getToken(), String.join(\", \", reqVidminkyNames), String.join(\", \", foundVidminkyNames));\n\n    if( state.ziZnaRemoved ) {\n      msg += \". Але з.в. вимагається у випадках порівнянн предметів.\";\n    }\n\n    if( state.posTagsToFind.contains(\"v_rod\")\n        && tokens[i].getToken().matches(\".*[ую]\")\n        && PosTagHelper.hasPosTag(tokenReadings.getReadings(), Pattern.compile(\"noun.*?:m:v_dav.*\")) ) {\n      msg += CaseGovernmentHelper.USED_U_INSTEAD_OF_A_MSG;\n    }\n    else if( tokenString.equals(\"їх\") && requiredPostTagsRegEx != null ) {\n      msg += \". Можливо, тут потрібно присвійний займенник «їхній» або нормативна форма р.в. «них»?\";\n      try {\n        String newYihPostag = \"adj:p\" + requiredPostTagsRegEx + \".*\";\n        String[] synthesized = synthesizer.synthesize(new AnalyzedToken(\"їхній\", \"adj:m:v_naz.*:pron:pos\", \"їхній\"), newYihPostag, true);\n        suggestions.addAll( Arrays.asList(synthesized) );\n      } catch (IOException e) {\n        throw new RuntimeException(e);\n      }\n    }\n    else if( (tokenString.equals(\"його\") || tokenString.equals(\"її\")) && requiredPostTagsRegEx != null ) {\n      String repl = tokenString.equals(\"його\") ? \"нього\" : \"неї\";\n      msg += \". Можливо, тут потрібно присвійний займенник «\" + repl + \"»?\";\n      try {\n        String newYihPostag = \"adj:p\" + requiredPostTagsRegEx + \".*\";\n        String[] synthesized = synthesizer.synthesize(new AnalyzedToken(\"їхній\", \"adj:m:v_naz.*:pron:pos\", \"їхній\"), newYihPostag, true);\n        suggestions.addAll( Arrays.asList(synthesized) );\n        suggestions.add(repl);\n      } catch (IOException e) {\n        throw new RuntimeException(e);\n      }\n    }\n    else if( state.prepTokenReadings.getCleanToken().equalsIgnoreCase(\"о\") ) {\n      for(AnalyzedToken token: tokenReadings.getReadings()) {\n        if( PosTagHelper.hasPosTag(token, NOUN_ANIM_V_NAZ_PATTERN) ) {\n          msg += \". Можливо, тут «о» — це вигук і потрібно кличний відмінок?\";","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/uk/src/main/java/org/languagetool/rules/uk/TokenAgreementPrepNounRule.java#L532-L568","documentation":"Same createRuleMatch() flow in TokenAgreementPrepNounRule, but for the special-case suggestion «їх» -> «їхній»: synthesize() is called with a synthetic AnalyzedToken(\"їхній\", ...) and IOException is wrapped in RuntimeException. The failure means the dictionary synthesizer could not be read while building this possessive-pronoun suggestion.","triggerScenarios":"Text contains «їх» where an adjectival possessive or normative genitive is expected; the rule synthesizes forms of «їхній» and the synthesizer throws IOException.","commonSituations":"Same root causes as other synthesis failures: damaged Morfologik dictionaries, storage I/O errors, broken deployment artifacts.","solutions":["Fix the underlying IOException found in the cause chain (resource, disk, permissions).","Rebuild/verify the uk dictionary resources in the artifact.","Degrade gracefully: keep the message but skip synthesized suggestions when synthesis fails.","Run a startup smoke test of the synthesizer to catch dictionary problems before serving requests.","Monitor for repeated RuntimeExceptions with this stack to detect environment-level dictionary corruption."],"exampleFix":"// before\nString[] synthesized = synthesizer.synthesize(new AnalyzedToken(\"їхній\", \"adj:m:v_naz.*:pron:pos\", \"їхній\"), newYihPostag, true);\n// after\nString[] synthesized;\ntry {\n  synthesized = synthesizer.synthesize(new AnalyzedToken(\"їхній\", \"adj:m:v_naz.*:pron:pos\", \"їхній\"), newYihPostag, true);\n} catch (IOException e) {\n  LOG.warn(\"synthesis for їхній failed\", e);\n  synthesized = new String[0];\n}","handlingStrategy":"try-catch","validationCode":"try {\n  synthesizer.synthesize(new AnalyzedToken(\"їхній\", \"adj:m:v_naz.*:pron:pos\", \"їхній\"), \"adj:p:v_naz\", true);\n} catch (IOException e) { throw new IllegalStateException(\"Cannot synthesize їхній forms\", e); }","typeGuard":null,"tryCatchPattern":"try { matchResult = rule.match(tokens); }\ncatch (RuntimeException e) {\n  if (e.getCause() instanceof IOException) { LOG.warn(\"їхній synthesis failed; keep message, drop suggestions\", e); }\n  else throw e;\n}","preventionTips":["Include the special-case pronoun paths in CI smoke tests","Verify dictionary integrity on deploy","Degrade to suggestion-less matches on synthesis I/O failure","Track cause-chain IOExceptions to catch environment degradation"],"tags":["io","synthesizer","pronoun","suggestions"],"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"}