{"record":{"id":"70a49930987b4451","repo":"stanfordnlp/CoreNLP","slug":"output-path-file-does-not-exist","errorCode":null,"errorMessage":"Output path ${file} does not exist","messagePattern":"Output path (.+?) does not exist","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/io/FileSystem.java","lineNumber":135,"sourceCode":"    mkdirOrFail(new File(dir));\n  }\n\n  /**\n   * Make the given directory or throw a RuntimeException\n   */\n  public static void mkdirOrFail(File dir) {\n    if (!dir.mkdirs()) {\n      String error = \"Could not create \" + dir;\n      log.info(error);\n      throw new RuntimeException(error);\n    }\n  }\n\n  public static void checkExistsOrFail(File file) {\n    if (!file.exists()) {\n      String error = \"Output path \" + file + \" does not exist\";\n      log.info(error);\n      throw new RuntimeException(error);\n    }\n  }\n\n  public static void checkNotExistsOrFail(File file) {\n    if (file.exists()) {\n      String error = \"Output path \" + file + \" already exists\";\n      log.info(error);\n      throw new RuntimeException(error);\n    }\n  }\n\n  /**\n   * Unit test code\n   */\n  public static void main(String[] args) {\n    String testDirName = \"FileSystemTest\";\n    String testFileName = \"Pair.java\";\n    ","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/io/FileSystem.java#L117-L153","documentation":"FileSystem.checkExistsOrFail(file) throws RuntimeException if the given file does not exist, logging 'Output path <file> does not exist'. It is a fail-fast precondition for reading or reusing an expected file.","triggerScenarios":"Calling checkExistsOrFail on a path that is missing: wrong relative path for current working directory, file not yet generated, deleted by a cleanup step, or case-mismatch on case-sensitive filesystems.","commonSituations":"Pipeline assumes a prior stage's output; models/JARs resource paths typed incorrectly; running from a different directory than during development; NAS mount not mounted.","solutions":["Verify the path exists from the shell (ls -l) with the same user and working directory as the Java process.","Use absolute paths or resolve against an explicit base directory.","Ensure the producing step completed before this check (ordering/synchronization).","Check case sensitivity and symlink targets on the filesystem."],"exampleFix":"// before\nFileSystem.checkExistsOrFail(new File(\"model.ser.gz\"));\n// after\nFile f = new File(\"model.ser.gz\").getAbsoluteFile();\nSystem.err.println(\"Looking for \" + f);\nFileSystem.checkExistsOrFail(f);","handlingStrategy":"validation","validationCode":"File f = file.getAbsoluteFile();\nif (!f.exists()) throw new FileNotFoundException(\"Expected output missing: \" + f);","typeGuard":null,"tryCatchPattern":"try {\n  FileSystem.checkExistsOrFail(file);\n} catch (RuntimeException e) {\n  log.severe(\"Missing path: \" + e.getMessage() + \" cwd=\" + new File(\".\").getAbsolutePath());\n}","preventionTips":["Use absolute paths or resolve against explicit base dirs","Verify prerequisite stages completed","Watch out for case-sensitive filesystems"],"tags":["file-io","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"}