apache/flink · error · IOException

Cannot find any jar files for plugin in directory [%s]. Plea

Error message

Cannot find any jar files for plugin in directory [%s]. Please provide the jar files for the plugin or delete the directory.

What it means

For each subdirectory of the plugins root, DirectoryBasedPluginFinder.createJarURLsFromDirectory collects files matching the '*.jar' glob. If the subdirectory contains no regular jar files it throws IOException('Cannot find any jar files for plugin in directory [<dir>]. Please provide the jar files for the plugin or delete the directory.'). Every directory under the plugins root is treated as a plugin and must contain at least one jar.

Source

Thrown at flink-core/src/main/java/org/apache/flink/core/plugin/DirectoryBasedPluginFinder.java:103

    private PluginDescriptor createPluginDescriptorForSubDirectory(Path subDirectory)
            throws IOException {
        URL[] urls = createJarURLsFromDirectory(subDirectory);
        Arrays.sort(urls, Comparator.comparing(URL::toString));
        // TODO: This class could be extended to parse exclude-pattern from a optional text files in
        // the plugin directories.
        return new PluginDescriptor(subDirectory.getFileName().toString(), urls, new String[0]);
    }

    private URL[] createJarURLsFromDirectory(Path subDirectory) throws IOException {
        try (Stream<Path> stream = Files.list(subDirectory)) {
            URL[] urls =
                    stream.filter((Path p) -> Files.isRegularFile(p) && jarFileMatcher.matches(p))
                            .map(FunctionUtils.uncheckedFunction((Path p) -> p.toUri().toURL()))
                            .toArray(URL[]::new);

            if (urls.length < 1) {
                throw new IOException(
                        "Cannot find any jar files for plugin in directory ["
                                + subDirectory
                                + "]."
                                + " Please provide the jar files for the plugin or delete the directory.");
            }

            return urls;
        }
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Put the plugin jar(s) directly inside the subdirectory: plugins/<name>/<name>-<version>.jar.
  2. If the directory is not meant to be a plugin, delete it entirely — an empty subdirectory is an error by design.
  3. Check for nested layout mistakes: jars must be at the top level of the subdirectory, not in nested folders, and must match the *.jar filename pattern.

Example fix

# before
plugins/
  my-plugin/            # empty -> IOException

# after
plugins/
  my-plugin/my-plugin-1.0.jar
Defensive patterns

Strategy: validation

Validate before calling

try (Stream<Path> s = Files.list(pluginsRoot)) {
    for (Path dir : (Iterable<Path>) s.filter(Files::isDirectory)::iterator) {
        boolean hasJar = Files.list(dir).anyMatch(p -> p.toString().endsWith(".jar"));
        if (!hasJar) {
            throw new IOException("plugin dir without jars: " + dir + " — remove it or add jars");
        }
    }
}

Prevention

When it happens

Trigger: An empty subdirectory under the plugins root, or one containing only non-jar files (docs, poms, extracted classes, hidden files) — the finder lists it as a plugin but finds zero matching jars.

Common situations: Leftover empty directories from a failed plugin install; users extracting a plugin jar instead of copying the jar; README/temp files dropped into a plugin folder; directory created as a placeholder for a future plugin.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/2bdf39763d40b8b9. Report an issue: GitHub.