stanfordnlp/CoreNLP · error · RuntimeIOException

RuntimeIOException wrapping IOException

Error message

RuntimeIOException wrapping IOException

What it means

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.

Solutions

  1. Check the cause IOException in the stack trace for the real failure
  2. Ensure the output directory for raw doc printing exists and is writable
  3. Free disk space / fix file permissions
  4. Verify corpus file paths in the dcoref properties

Example fix

// before
props.setProperty("coref.printRawDoc", "true"); // writes to nonexistent dir
// after
new File("output/raw").mkdirs();
props.setProperty("coref.printRawDoc", "true");
Defensive patterns

Strategy: try-catch

Validate before calling

File outDir = new File(rawDocOutputDir);
if (!outDir.isDirectory() || !outDir.canWrite())
  throw new IllegalStateException("raw doc output dir not writable");

Try / catch

try {
  MentionExtractor.ChainInfo info = extractor.nextDoc();
} catch (RuntimeIOException e) {
  logger.severe("doc read failed: " + e.getCause());
  throw e;
}

Prevention

When it happens

Trigger: IOException raised inside nextDoc — typically printRawDoc failing to write output files, or mentionFinder/annotation I/O failures (missing output directory, disk full, bad permissions).

Common situations: Output directory for raw document dumps does not exist or is not writable; disk quota exceeded while running dcoref over the ACE corpus.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/f4f907707c813a6f. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/dcoref/ACEMentionExtractor.java:162

        for(CoreLabel w : s.get(CoreAnnotations.TokensAnnotation.class)){
          w.set(CoreAnnotations.IndexAnnotation.class, i++);
          if(!w.containsKey(CoreAnnotations.UtteranceAnnotation.class)) {
            w.set(CoreAnnotations.UtteranceAnnotation.class, 0);
          }
        }
        allTrees.add(s.get(TreeCoreAnnotations.TreeAnnotation.class));
        allWords.add(s.get(CoreAnnotations.TokensAnnotation.class));
        EntityComparator comparator = new EntityComparator();
        extractGoldMentions(s, allGoldMentions, comparator);
      }

      if(Constants.USE_GOLD_MENTIONS) allPredictedMentions = allGoldMentions;
      else allPredictedMentions = mentionFinder.extractPredictedMentions(anno, maxID, dictionaries);

      printRawDoc(sentences, allGoldMentions, filename, true);
      printRawDoc(sentences, allPredictedMentions, filename, false);
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }

    return arrange(anno, allWords, allTrees, allPredictedMentions, allGoldMentions, true);
  }

  private void extractGoldMentions(CoreMap s, List<List<Mention>> allGoldMentions, EntityComparator comparator) {
    List<Mention> goldMentions = new ArrayList<>();
    allGoldMentions.add(goldMentions);
    List<EntityMention> goldMentionList = s.get(MachineReadingAnnotations.EntityMentionsAnnotation.class);
    List<CoreLabel> words = s.get(CoreAnnotations.TokensAnnotation.class);

    TreeSet<EntityMention> treeForSortGoldMentions = new TreeSet<>(comparator);
    if(goldMentionList!=null) treeForSortGoldMentions.addAll(goldMentionList);
    if(!treeForSortGoldMentions.isEmpty()){
      for(EntityMention e : treeForSortGoldMentions){
        Mention men = new Mention();
        men.dependency = s.get(SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class);
        if (men.dependency == null) {

View on GitHub (pinned to 1b7edd19c4)