{"record":{"id":"8b649cd2db2387f5","repo":"stanfordnlp/CoreNLP","slug":"ioe","errorCode":null,"errorMessage":"ioe","messagePattern":"ioe","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/trees/treebank/EnglishPTBTreebankCorrector.java","lineNumber":99,"sourceCode":"    try {\n      BufferedReader br = getBufferedReader(editStr);\n      List<TsurgeonPattern> tsp = new ArrayList<>();\n      for (String line; (line = br.readLine()) != null; ) {\n        TregexPattern matchPattern = tpc.compile(line);\n        tsp.clear();\n        if (DEBUG) log.info(\"Pattern is \" + line + \" [\" + matchPattern + ']');\n        while (continuing(line = br.readLine())) {\n          TsurgeonPattern p = Tsurgeon.parseOperation(line);\n          if (DEBUG) log.info(\"Operation is \" + line + \" [\" + p + ']');\n          tsp.add(p);\n        }\n        if ( ! tsp.isEmpty()) {\n          TsurgeonPattern tp = Tsurgeon.collectOperations(tsp);\n          ops.add(new Pair<>(matchPattern, tp));\n        }\n      } // while not at end of file\n    } catch (IOException ioe) {\n      log.warn(ioe);\n    }\n  }\n\n  @Override\n  public Tree transformTree(Tree t) {\n    return Tsurgeon.processPatternsOnTree(ops, t);\n  }\n\n  /** Fix all the English Penn Treebank errors, or at least some of them (!).\n   */\n  @Override\n  public MemoryTreebank transformTrees(Treebank tb) {\n    MemoryTreebank mtb = new MemoryTreebank(tb.treeReaderFactory(),\n                                            tb.encoding());\n    for (Tree t : tb) {\n      mtb.add(transformTree(t));\n    }\n    return mtb;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/treebank/EnglishPTBTreebankCorrector.java#L81-L117","documentation":"EnglishPTBTreebankCorrector's constructor reads Tsurgeon operation files from the classpath/data path and catches IOException, logging it with log.warn(ioe). The correction operations list is left (partially) empty, so subsequent transformTree calls silently apply fewer corrections than intended.","triggerScenarios":"Instantiating EnglishPTBTreebankCorrector while its Tsurgeon operation script (and regex file it references) cannot be read — missing resource on classpath, wrong working directory, or corrupted/unreadable data file.","commonSituations":"Running the English parser pipeline from a jar/classpath layout missing the treebank correction resources; packaging the library without data files; running from a different working directory where relative data paths do not resolve.","solutions":["Verify the Tsurgeon operation files are on the classpath and included in your build/jar (check the stanford-corenlp data resources)","Run with the correct working directory / ensure paths resolve relative to where the JVM was launched","Log/inspect the full IOException stack trace (enable debug logging) to identify the exact missing file","If corrections are optional, accept the warning; otherwise fail fast by rethrowing instead of warn-and-continue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try (InputStream in = getClass().getResourceAsStream(OPS_FILE)) {\n  if (in == null) throw new FileNotFoundException(\"missing resource: \" + OPS_FILE);\n  // load operations\n} catch (IOException ioe) {\n  throw new IllegalStateException(\"Failed to load treebank correction operations\", ioe);\n}","preventionTips":["Include all stanford-nlp data resources in your jar/build (shade plugin excludes are a common cause)","Fail fast on missing correction resources rather than silently degrading transformTree","Pin and verify your stanford-corenlp artifact contents after upgrading"],"tags":["io","classpath","nlp","resource-missing"],"backgroundTag":"file-read-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"}