stanfordnlp/CoreNLP · error · RuntimeIOException

RuntimeIOException wrapping IOException

Error message

RuntimeIOException wrapping IOException

What it means

CoNLL2011DocumentReader.getNextDocument reads the next CoNLL document and rethrows any IOException raised while reading/advancing the underlying DocumentIterator as an unchecked RuntimeIOException wrapping the original exception.

Solutions

  1. Inspect the wrapped IOException cause to find the failing file
  2. Verify all files listed in the CoNLL corpus file list exist and are readable
  3. Re-download/verify the CoNLL corpus archives (check integrity)
  4. Fix file/directory permissions on the corpus path

Example fix

// before
String path = "/data/conll/train/missing_file.v4_gold_conll";
// after
File f = new File(path);
if (!f.canRead()) throw new IllegalStateException("missing corpus file: " + path);
Defensive patterns

Strategy: try-catch

Validate before calling

for (String f : corpusFiles)
  if (!new File(f).canRead()) throw new IllegalStateException("unreadable corpus file: " + f);

Try / catch

try {
  Document d = reader.getNextDocument();
} catch (RuntimeIOException e) {
  logger.severe("CoNLL read failed: " + e.getCause());
  throw e;
}

Prevention

When it happens

Trigger: IOException thrown by docIterator.next() or when constructing a new DocumentIterator for the next file — corrupt/missing CoNLL corpus file, unreadable path, or gzipped file problems.

Common situations: Corrupt CoNLL-2011/2012 corpus files, wrong file path in the corpus listing, truncated downloads of the CoNLL data, permission issues on the data directory.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/dcoref/CoNLL2011DocumentReader.java:137

      File curFile = fileList.get(curFileIndex);
      if (docIterator == null) {
        docIterator = new DocumentIterator(curFile.getAbsolutePath(), options);
      }
      while ( ! docIterator.hasNext()) {
        logger.info("Processed " + docIterator.docCnt + " documents in " + curFile.getAbsolutePath());
        docIterator.close();
        curFileIndex++;
        if (curFileIndex >= fileList.size()) {
          return null;  // DONE!
        }
        curFile = fileList.get(curFileIndex);
        docIterator = new DocumentIterator(curFile.getAbsolutePath(), options);
      }
      Document next = docIterator.next();
      SieveCoreferenceSystem.logger.fine("Reading document: " + next.getDocumentID());
      return next;
    } catch (IOException ex) {
      throw new RuntimeIOException(ex);
    }
  }

  public void close()
  {
    IOUtils.closeIgnoringExceptions(docIterator);
  }

  public static class NamedEntityAnnotation implements CoreAnnotation<CoreMap> {
    public Class<CoreMap> getType() {
      return CoreMap.class;
    }
  }

  public static class CorefMentionAnnotation implements CoreAnnotation<CoreMap> {
    public Class<CoreMap> getType() {
      return CoreMap.class;
    }

View on GitHub (pinned to 1b7edd19c4)