stanfordnlp/CoreNLP · error · RuntimeIOException

CTBunk I/O error

Error message

CTBunk I/O error: ${filename}

What it means

While reading the CTBunk dictionary file, readCTBunkDict() can also fail with a general IOException (I/O error other than file-not-found, e.g., read failure, permissions, or stream corruption). It is rethrown as RuntimeIOException with this message, keeping the original exception as the cause.

Solutions

  1. Check file permissions and readability (chmod/chown) for the user running the JVM.
  2. Verify the file isn't truncated or corrupt — re-extract or re-download the tagger resource distribution.
  3. Inspect the wrapped cause (e.getCause()) of the RuntimeIOException to identify the exact underlying I/O problem.

Example fix

// before
// CTBunk file with mode 0600 owned by another user
java ... // RuntimeIOException: CTBunk I/O error
// after
chmod 644 /path/to/ctbunki.txt
Defensive patterns

Strategy: try-catch

Validate before calling

// Java: check readability before load
File f = new File(ctbunkPath);
boolean readable = f.isFile() && f.canRead() && f.length() > 0;

Try / catch

// Java
try {
  CTBunkDict d = new CTBunkDict(filename);
} catch (RuntimeIOException e) {
  logger.severe("CTBunk read failed: " + e.getCause()); // inspect cause
  throw e;
}

Prevention

When it happens

Trigger: Calling the CTBunkDict constructor when opening/reading the CTBunk file throws IOException — unreadable file, permission errors, disk/network stream failure, or a truncated/corrupt file raising an I/O error mid-read.

Common situations: File with restrictive permissions, file on a flaky network mount, or resource loaded from a damaged jar/classpath entry where the stream fails during reading.

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/069136551eb863ad. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/tagger/maxent/CTBunkDict.java:56

      BufferedReader CTBunkDetectorReader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "GB18030"));
      for (String CTBunkDetectorLine; (CTBunkDetectorLine = CTBunkDetectorReader.readLine()) != null; ) {
        String[] fields = CTBunkDetectorLine.split(" ");
        String tag=fields[1];
        Set<String> words=CTBunk_dict.get(tag);

        if(words==null){
          words = Generics.newHashSet();
          CTBunk_dict.put(tag,words);
        }
        words.add(fields[0]);

      }

    } catch (FileNotFoundException e) {
      throw new RuntimeIOException("CTBunk file not found: " + filename, e);
    } catch (IOException e) {
      throw new RuntimeIOException("CTBunk I/O error: " + filename, e);
    }
  }



  /**
   * Returns "1" as true if the dictionary listed this word with this tag,
   *  and "0" otherwise.
   *
   * @param tag  The POS tag
   * @param word The word
   * @return "1" as true if the dictionary listed this word with this tag,
   *  and "0" otherwise.
   */
  protected static String getTag(String tag, String word) {
    CTBunkDict dict = CTBunkDict.getInstance();
    Set<String> words = dict.get(tag);
    if (words != null && words.contains(word)) {

View on GitHub (pinned to 1b7edd19c4)