{"record":{"id":"1b6c195d9e982622","repo":"stanfordnlp/CoreNLP","slug":"ctbunk-file-not-found-filename","errorCode":null,"errorMessage":"CTBunk file not found: ${filename}","messagePattern":"CTBunk file not found: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/tagger/maxent/CTBunkDict.java","lineNumber":54,"sourceCode":"\n    try{\n\n      BufferedReader CTBunkDetectorReader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), \"GB18030\"));\n      for (String CTBunkDetectorLine; (CTBunkDetectorLine = CTBunkDetectorReader.readLine()) != null; ) {\n        String[] fields = CTBunkDetectorLine.split(\" \");\n        String tag=fields[1];\n        Set<String> words=CTBunk_dict.get(tag);\n\n        if(words==null){\n          words = Generics.newHashSet();\n          CTBunk_dict.put(tag,words);\n        }\n        words.add(fields[0]);\n\n      }\n\n    } catch (FileNotFoundException e) {\n      throw new RuntimeIOException(\"CTBunk file not found: \" + filename, e);\n    } catch (IOException e) {\n      throw new RuntimeIOException(\"CTBunk I/O error: \" + filename, e);\n    }\n  }\n\n\n\n  /**\n   * Returns \"1\" as true if the dictionary listed this word with this tag,\n   *  and \"0\" otherwise.\n   *\n   * @param tag  The POS tag\n   * @param word The word\n   * @return \"1\" as true if the dictionary listed this word with this tag,\n   *  and \"0\" otherwise.\n   */\n  protected static String getTag(String tag, String word) {\n    CTBunkDict dict = CTBunkDict.getInstance();","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/tagger/maxent/CTBunkDict.java#L36-L72","documentation":"CTBunkDict.readCTBunkDict() loads the CTBunk (Chinese Treebank) dictionary file specified by the loader's filename argument. When the file cannot be found on disk, the caught FileNotFoundException is rethrown as a RuntimeIOException with this message. It typically means the CTBunk resource is missing or its path is wrong.","triggerScenarios":"Constructing CTBunkDict (via DistributionFactory / the MaxentTagger feature pipeline, e.g. with a ctb features file) when the configured CTBunk file path doesn't exist at runtime.","commonSituations":"Running the Chinese POS tagger without the required CTBunk dictionary file distributed separately, wrong working directory so relative paths don't resolve, or config pointing to a renamed/moved resource.","solutions":["Download/obtain the CTBunk dictionary file and place it at the path the tagger expects (it ships in the tagger's resource distribution for Chinese models).","Verify the configured path/filename — check the working directory and make relative paths absolute.","Run with the correct model/config that requires CTBunk only if you actually have the resource, or switch to a model whose features don't need it."],"exampleFix":"// before\njava -cp stanford-postagger.jar ... -model chinese.tagger // CTBunk file absent\n// after\nls /models/ctbunki.txt # ensure file exists, or set the path in config\ngazettedir=/full/path/to/ctbunk/resources","handlingStrategy":"validation","validationCode":"// Java: verify CTBunk resource exists before initializing the tagger\nFile f = new File(ctbunkPath);\nif (!f.isFile()) throw new IllegalStateException(\"Missing CTBunk file: \" + ctbunkPath);","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n  CTBunkDict d = new CTBunkDict(filename);\n} catch (RuntimeIOException e) {\n  log(\"CTBunk resource missing; install it or switch models\", e);\n}","preventionTips":["Ship/install the Chinese tagger's resource distribution which includes the CTBunk file.","Use absolute paths for resources in configs and scripts.","Check working directory assumptions in launch scripts and CI."],"tags":["nlp","chinese","pos-tagger","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}