{"record":{"id":"4d3d970471c85c85","repo":"languagetool-org/languagetool","slug":"ioexception-while-writing-debug-tags","errorCode":null,"errorMessage":"IOException while writing debug tags","messagePattern":"IOException while writing debug tags","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/uk/src/main/java/org/languagetool/tagging/uk/CompoundDebugLogger.java","lineNumber":119,"sourceCode":"        \n        String lemma = analyzedToken.getLemma();\n\n        if (! prevLemma.equals(lemma)) {\n          if( prevLemma.length() > 0 ) {\n            writer.append(\", \");\n          }\n          writer.append(lemma); //.append(' ');\n          prevLemma = lemma;\n          firstTag = true;\n        }\n\n        writer.append(firstTag ? \" \" : \"|\").append(analyzedToken.getPOSTag());\n        firstTag = false;\n      }\n      writer.newLine();\n      if( ++cnt % 10 == 0) writer.flush();\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  public void logGenderMix(String word, boolean leftNv, String leftPosTag, String rightPosTag) {\n    if( compoundGenderMixDebugWriter != null ) {\n      try {\n        compoundGenderMixDebugWriter.append(word + \" \" + (leftNv ? rightPosTag : leftPosTag));\n        compoundGenderMixDebugWriter.newLine();\n        compoundGenderMixDebugWriter.flush();\n      } catch (IOException e) {\n        System.err.println(\"Failed to write into gender mix file\");\n      }\n    }\n  }\n\n}\n","sourceCodeStart":101,"sourceCodeEnd":136,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/uk/src/main/java/org/languagetool/tagging/uk/CompoundDebugLogger.java#L101-L136","documentation":"The debug_tagged_write step in CompoundDebugLogger writes POSTag analysis of Ukrainian compounds to a debug file; an IOException there is rethrown as a RuntimeException with this message. The real cause (e.g. closed stream or disk error) is in the wrapped exception.","triggerScenarios":"logTaggedCompound -> debug_tagged_write when the debug BufferedWriter cannot flush or append: file removed, permissions changed, stream closed, or disk full after every 10th write triggers flush().","commonSituations":"Long-running Ukrainian tagging sessions where the debug log file was deleted by tmp cleaners, or CI containers with a full /tmp volume.","solutions":["Verify the debug file's directory is writable and has free space","Keep the debug writer open for the lifetime of the tagging session","Check the cause IOException in the stacktrace for the underlying error","Turn off compound debug logging in production"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Files.getFileSystem(debugDir).getReadOnlyStores().size() == 0\n        && Files.getFileStore(debugDir).getTotalSpace() > 0) { /* ok */ }","typeGuard":null,"tryCatchPattern":"try {\n    compoundLogger.logTaggedCompound(word, tokens);\n} catch (RuntimeException e) {\n    Throwable c = e.getCause();\n    if (c instanceof IOException) { LOGGER.warn(\"debug tags write failed\", c); }\n    else throw e;\n}","preventionTips":["Disable debug writers in production configurations","Ensure the debug file stays open for the whole tagging run","Avoid tmp-cleanup daemons deleting open debug files' directories","Handle periodic flush() failures by recreating the writer"],"tags":["io","java","logging","filesystem"],"backgroundTag":"file-write-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"}