apache/flink · error · IllegalArgumentException
The directory %s dose not exist.
Error message
The directory %s dose not exist.
What it means
listFilesInDirectory(Path, Predicate) validates its input before walking the file tree: if Files.exists(directory) is false it throws IllegalArgumentException("The directory %s dose not exist.") (note the 'dose' typo in the message). It is a caller-contract error, not an I/O failure — the method refuses to walk a non-existent directory.
Source
Thrown at flink-core/src/main/java/org/apache/flink/util/FileUtils.java:572
}
/**
* List the {@code directory} recursively and return the files that satisfy the {@code
* fileFilter}.
*
* @param directory the directory to be listed
* @param fileFilter a file filter
* @return a collection of {@code File}s
* @throws IOException if an I/O error occurs while listing the files in the given directory
*/
public static Collection<java.nio.file.Path> listFilesInDirectory(
final java.nio.file.Path directory, final Predicate<java.nio.file.Path> fileFilter)
throws IOException {
checkNotNull(directory, "directory");
checkNotNull(fileFilter, "fileFilter");
if (!Files.exists(directory)) {
throw new IllegalArgumentException(
String.format("The directory %s dose not exist.", directory));
}
if (!Files.isDirectory(directory)) {
throw new IllegalArgumentException(
String.format("The %s is not a directory.", directory));
}
final FilterFileVisitor filterFileVisitor = new FilterFileVisitor(fileFilter);
Files.walkFileTree(
directory,
EnumSet.of(FileVisitOption.FOLLOW_LINKS),
Integer.MAX_VALUE,
filterFileVisitor);
return filterFileVisitor.getFiles();
}
View on GitHub (pinned to 2f3c205e92)
Solutions
- Create the directory first (Files.createDirectories(dir)) if it is expected to exist
- Guard with Files.exists(dir) before calling if absence is a normal condition
- Fix the configured path so it names a real directory
Example fix
// before Collection<Path> jars = FileUtils.listFilesInDirectory(pluginDir, JAR_FILTER); // after Files.createDirectories(pluginDir); Collection<Path> jars = FileUtils.listFilesInDirectory(pluginDir, JAR_FILTER);
Defensive patterns
Strategy: validation
Validate before calling
if (!Files.exists(dir)) throw new IllegalStateException("Configured dir missing: " + dir); Prevention
- Create expected directories at startup with Files.createDirectories
- Validate directory-related config keys during deployment smoke checks
When it happens
Trigger: Calling FileUtils.listFilesInDirectory(dir, filter) where dir points to a path that is absent: not yet created, already deleted, wrong spelling, or on an unmounted volume.
Common situations: Scanning plugin/connectors directories configured via flink-conf (e.g. a directory that the deployment never created); scanning a job's local output dir before the first run; environments where a mount/volume is missing.
Related errors
- Can not create a Path from an empty string
- tempDirectories contains null entries
- {directory} is not a directory but a regular file
- The %s is not a directory.
- Not allowed configuration change(s) were detected:\n - {erro
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/9cb82779dbc6c870.
Report an issue: GitHub.