{"record":{"id":"f4f907707c813a6f","repo":"stanfordnlp/CoreNLP","slug":"runtimeioexception-wrapping-ioexception-f4f907","errorCode":null,"errorMessage":"RuntimeIOException wrapping IOException","messagePattern":"RuntimeIOException wrapping IOException","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/ACEMentionExtractor.java","lineNumber":162,"sourceCode":"        for(CoreLabel w : s.get(CoreAnnotations.TokensAnnotation.class)){\n          w.set(CoreAnnotations.IndexAnnotation.class, i++);\n          if(!w.containsKey(CoreAnnotations.UtteranceAnnotation.class)) {\n            w.set(CoreAnnotations.UtteranceAnnotation.class, 0);\n          }\n        }\n        allTrees.add(s.get(TreeCoreAnnotations.TreeAnnotation.class));\n        allWords.add(s.get(CoreAnnotations.TokensAnnotation.class));\n        EntityComparator comparator = new EntityComparator();\n        extractGoldMentions(s, allGoldMentions, comparator);\n      }\n\n      if(Constants.USE_GOLD_MENTIONS) allPredictedMentions = allGoldMentions;\n      else allPredictedMentions = mentionFinder.extractPredictedMentions(anno, maxID, dictionaries);\n\n      printRawDoc(sentences, allGoldMentions, filename, true);\n      printRawDoc(sentences, allPredictedMentions, filename, false);\n    } catch (IOException e) {\n      throw new RuntimeIOException(e);\n    }\n\n    return arrange(anno, allWords, allTrees, allPredictedMentions, allGoldMentions, true);\n  }\n\n  private void extractGoldMentions(CoreMap s, List<List<Mention>> allGoldMentions, EntityComparator comparator) {\n    List<Mention> goldMentions = new ArrayList<>();\n    allGoldMentions.add(goldMentions);\n    List<EntityMention> goldMentionList = s.get(MachineReadingAnnotations.EntityMentionsAnnotation.class);\n    List<CoreLabel> words = s.get(CoreAnnotations.TokensAnnotation.class);\n\n    TreeSet<EntityMention> treeForSortGoldMentions = new TreeSet<>(comparator);\n    if(goldMentionList!=null) treeForSortGoldMentions.addAll(goldMentionList);\n    if(!treeForSortGoldMentions.isEmpty()){\n      for(EntityMention e : treeForSortGoldMentions){\n        Mention men = new Mention();\n        men.dependency = s.get(SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class);\n        if (men.dependency == null) {","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/ACEMentionExtractor.java#L144-L180","documentation":"ACEMentionExtractor.nextDoc reads and prints the ACE document, and any IOException encountered while writing raw doc output or extracting mentions is rethrown as an unchecked RuntimeIOException with the original IOException as cause.","triggerScenarios":"IOException raised inside nextDoc — typically printRawDoc failing to write output files, or mentionFinder/annotation I/O failures (missing output directory, disk full, bad permissions).","commonSituations":"Output directory for raw document dumps does not exist or is not writable; disk quota exceeded while running dcoref over the ACE corpus.","solutions":["Check the cause IOException in the stack trace for the real failure","Ensure the output directory for raw doc printing exists and is writable","Free disk space / fix file permissions","Verify corpus file paths in the dcoref properties"],"exampleFix":"// before\nprops.setProperty(\"coref.printRawDoc\", \"true\"); // writes to nonexistent dir\n// after\nnew File(\"output/raw\").mkdirs();\nprops.setProperty(\"coref.printRawDoc\", \"true\");","handlingStrategy":"try-catch","validationCode":"File outDir = new File(rawDocOutputDir);\nif (!outDir.isDirectory() || !outDir.canWrite())\n  throw new IllegalStateException(\"raw doc output dir not writable\");","typeGuard":null,"tryCatchPattern":"try {\n  MentionExtractor.ChainInfo info = extractor.nextDoc();\n} catch (RuntimeIOException e) {\n  logger.severe(\"doc read failed: \" + e.getCause());\n  throw e;\n}","preventionTips":["Create and verify output directories before extraction","Check disk space and permissions before corpus runs","Always inspect getCause() for the underlying IOException"],"tags":["io","file-write","corpus","dcoref"],"backgroundTag":"file-write-failed","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}