stanfordnlp/CoreNLP · error · IllegalArgumentException
Directory access problem for
Error message
Directory access problem for: ${path} What it means
FilePathProcessor.processPath throws IllegalArgumentException when File.listFiles(filter) returns null on a directory, which the JVM does when the directory cannot be read (I/O error or access denied). It surfaces a filesystem access problem while recursively processing a path.
Solutions
- Check canRead() on the path before processing and skip/report unreadable directories.
- Run the process with sufficient filesystem permissions, or use a user with access to the target tree.
- Verify the directory exists and is not concurrently deleted; handle races defensively.
- Catch IllegalArgumentException around processPath and log/skip the offending path instead of aborting the whole walk.
Example fix
// before
FilePathProcessor.processPath(new File("/root/secure"), filter, proc);
// after
File dir = new File("/root/secure");
if (dir.isDirectory() && dir.canRead()) {
FilePathProcessor.processPath(dir, filter, proc);
} else {
log.warn("Skipping unreadable directory: " + dir);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (path.isDirectory() && !path.canRead()) { log.warn("Skipping unreadable: " + path); return; } Type guard
boolean isReadableDirectory(File f) { return f != null && f.isDirectory() && f.canRead(); } Try / catch
try { FilePathProcessor.processPath(dir, filter, proc); } catch (IllegalArgumentException e) { log.warn("Skipping: " + e.getMessage()); } Prevention
- Check canRead() before walking directories
- Run with a user that has read access to the target tree
- Handle paths deleted mid-traversal defensively
- Skip-and-log unreadable entries instead of aborting whole walks
When it happens
Trigger: Calling processPath on a directory the process lacks read permission for, a directory that vanished mid-walk, or an I/O error during listing.
Common situations: Running on paths owned by another user; restricted sandboxes/containers; walking system directories; race where the directory is deleted during traversal.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- Could not create directory <tgtDir.getAbsolutePath()>
- cp: could not list files in source
- Could not open temporary feature index file for writing.
- Could not open temporary feature index file for reading.
- Could not create directory <tgtDir.getAbsolutePath()>, as a…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/fd89c82483a463e1.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/util/FilePathProcessor.java:76
* filter are processed. If the <code>path</code>is a file, then
* that file is processed regardless of whether it satisfies the
* filter. (This semantics was adopted, since otherwise there was no
* easy way to go through all the files in a directory without
* descending recursively via the specification of a
* <code>FileFilter</code>.)
*
* @param path file or directory to load from
* @param filter a FileFilter of files to load. The filter may be null,
* and then all files are processed.
* @param processor The <code>FileProcessor</code> to apply to each
* <code>File</code>
*/
public static void processPath(File path, FileFilter filter, FileProcessor processor) {
if (path.isDirectory()) {
// if path is a directory, look into it
File[] directoryListing = path.listFiles(filter);
if (directoryListing == null) {
throw new IllegalArgumentException("Directory access problem for: " + path);
}
for (File file : directoryListing) {
processPath(file, filter, processor);
}
} else {
// it's already passed the filter or was uniquely specified
// if (filter.accept(path))
processor.processFile(path);
}
}
}
View on GitHub (pinned to 1b7edd19c4)