{"record":{"id":"df020255d279192e","repo":"stanfordnlp/CoreNLP","slug":"file-doesn-t-exist-path","errorCode":null,"errorMessage":"File doesn't exist: ${path}","messagePattern":"File doesn't exist: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/io/FileSequentialCollection.java","lineNumber":363,"sourceCode":"                  fileArrayStack.push(directoryListing);\n                  fileArrayStackIndices.push(Integer.valueOf(0));\n                }\n                return path;\n              } else {\n                // we don't include the dir, so we'll push\n                // the directory and loop around again ...\n                if (directoryListing.length > 0) {\n                  fileArrayStack.push(directoryListing);\n                  fileArrayStackIndices.push(Integer.valueOf(0));\n                }\n                // otherwise there was nothing in the\n                // directory; we will pop back up\n              }\n            } else {\n              // it's just a fixed file\n              // log.info(\"Got a plain file \" + path);\n              if (!path.exists()) {\n                throw new IllegalArgumentException(\"File doesn't exist: \" + path);\n              }\n              return path;\n            }\n          }\n          // go through loop again. we've pushed or popped as needed\n        }\n        // finished this root entry; go on to the next\n        rootsIndex++;\n        if (rootsIndex < roots.length) {\n          fileArrayStack.add(roots[rootsIndex]);\n          fileArrayStackIndices.push(Integer.valueOf(0));\n        }\n      }\n      // finished everything\n      return null;\n    }\n\n  }","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/io/FileSequentialCollection.java#L345-L381","documentation":"For a non-directory seed element, FileSequentialCollection returns the file directly but first checks path.exists(). If the file is missing it throws IllegalArgumentException with the path. This is a fail-fast guard against nonexistent plain files.","triggerScenarios":"Constructing/iterating a FileSequentialCollection with a seed file path that does not exist on disk (typo, wrong working directory, file deleted before iteration).","commonSituations":"Relative paths resolved against an unexpected CWD; datasets downloaded later than expected; files cleaned by a job; configuration pointing at a machine-specific location.","solutions":["Check new File(path).exists() for every seed file before building the collection.","Use absolute paths or resolve relative paths against an explicit base directory.","Re-create/re-download the missing file or fix the path in configuration.","Verify the file wasn't deleted by a prior pipeline step (check cleanup scripts)."],"exampleFix":"// before\nnew FileSequentialCollection(Arrays.asList(\"corpus/train.txt\"));\n// after\nFile f = new File(\"corpus/train.txt\");\nif (!f.exists()) throw new FileNotFoundException(f.getAbsolutePath());\nnew FileSequentialCollection(Collections.singletonList(f));","handlingStrategy":"validation","validationCode":"File f = new File(path);\nif (!f.exists()) {\n  throw new FileNotFoundException(f.getAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"try {\n  for (File f : new FileSequentialCollection(seeds, filt, includeDirs)) { process(f); }\n} catch (IllegalArgumentException e) {\n  log.severe(\"Missing file: \" + e.getMessage());\n}","preventionTips":["Call .getAbsoluteFile() and log paths before use","Check exists() for each seed file up front","Ensure producing pipeline stages finish before consumption"],"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"}