{"record":{"id":"6b38ba3be7e83913","repo":"apache/flink","slug":"the-s-is-not-a-directory","errorCode":null,"errorMessage":"The %s is not a directory.","messagePattern":"The (.+?) is not a directory\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/FileUtils.java","lineNumber":576,"sourceCode":"     * fileFilter}.\n     *\n     * @param directory the directory to be listed\n     * @param fileFilter a file filter\n     * @return a collection of {@code File}s\n     * @throws IOException if an I/O error occurs while listing the files in the given directory\n     */\n    public static Collection<java.nio.file.Path> listFilesInDirectory(\n            final java.nio.file.Path directory, final Predicate<java.nio.file.Path> fileFilter)\n            throws IOException {\n        checkNotNull(directory, \"directory\");\n        checkNotNull(fileFilter, \"fileFilter\");\n\n        if (!Files.exists(directory)) {\n            throw new IllegalArgumentException(\n                    String.format(\"The directory %s dose not exist.\", directory));\n        }\n        if (!Files.isDirectory(directory)) {\n            throw new IllegalArgumentException(\n                    String.format(\"The %s is not a directory.\", directory));\n        }\n\n        final FilterFileVisitor filterFileVisitor = new FilterFileVisitor(fileFilter);\n\n        Files.walkFileTree(\n                directory,\n                EnumSet.of(FileVisitOption.FOLLOW_LINKS),\n                Integer.MAX_VALUE,\n                filterFileVisitor);\n\n        return filterFileVisitor.getFiles();\n    }\n\n    /**\n     * Computes the sum of sizes of all files in the directory and it's subdirectories.\n     *\n     * @param path the root path from which to start the calculation.","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L558-L594","documentation":"The second validation in listFilesInDirectory: the path exists but Files.isDirectory(directory) is false, so the method throws IllegalArgumentException(\"The %s is not a directory.\"). A regular file (or special fs object) was passed where a traversable directory is required.","triggerScenarios":"Calling listFilesInDirectory with a path that names a regular file — e.g. pointing a 'scan this directory' option directly at a jar/zip file instead of the folder containing it.","commonSituations":"Configuration mistakes where a *-dir option is given a file path; a symlinked path resolving to a file; a previous run leaving a file where a directory was expected.","solutions":["Point the call at the containing directory, not at a file","Validate with Files.isDirectory(dir) and report the exact configured value in your own error message","Delete or rename the stale file that occupies the expected directory location"],"exampleFix":"// before\nPath p = Paths.get(config.get(\"plugins.dir\")); // user set plugins.dir=/opt/flink/lib/flink-connector.jar\nFileUtils.listFilesInDirectory(p, JAR_FILTER);\n\n// after\nPath p = Paths.get(config.get(\"plugins.dir\"));\nif (!Files.isDirectory(p)) throw new IllegalStateException(\"plugins.dir must be a directory: \" + p);","handlingStrategy":"validation","validationCode":"if (!Files.isDirectory(dir)) throw new IllegalStateException(\"Expected a directory but got a file: \" + dir);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point *-dir settings at folders, not jars/files","Include the resolved path in config validation errors"],"tags":["filesystem","validation","configuration"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}