apache/flink · error · IOException

JAR file does not exist '{}'

Error message

JAR file does not exist '{}'

What it means

JarUtils.checkJarFile verifies the jar URL points to an existing file. After converting the URL to a File, if !jarFile.exists() this IOException is thrown with the absolute path that was checked. It is the standard failure when a user-supplied jar path points to nothing on disk.

Source

Thrown at flink-core/src/main/java/org/apache/flink/util/JarUtils.java:46

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarFile;
import java.util.stream.Collectors;

/** Utility functions for jar files. */
@Internal
public class JarUtils {

    public static void checkJarFile(URL jar) throws IOException {
        File jarFile;
        try {
            jarFile = new File(jar.toURI());
        } catch (URISyntaxException e) {
            throw new IOException("JAR file path is invalid '" + jar + '\'');
        }
        if (!jarFile.exists()) {
            throw new IOException("JAR file does not exist '" + jarFile.getAbsolutePath() + '\'');
        }
        if (!jarFile.canRead()) {
            throw new IOException("JAR file can't be read '" + jarFile.getAbsolutePath() + '\'');
        }

        try (JarFile ignored = new JarFile(jarFile)) {
            // verify that we can open the Jar file
        } catch (IOException e) {
            throw new IOException(
                    "Error while opening jar file '" + jarFile.getAbsolutePath() + '\'', e);
        }
    }

    public static List<URL> getJarFiles(final String[] jars) {
        if (jars == null) {
            return Collections.emptyList();
        }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Verify the absolute path printed in the message actually exists on the machine running the check (JobManager for cluster submissions, not your laptop).
  2. Use an absolute path or ship the jar inside the job submission/user jar instead of referencing a cluster-local file.
  3. Fix typos in the jar path in the CLI argument or configuration (e.g. pipeline.jars, python.executable.jars).
  4. If running in containers/K8s, make sure the jar is present in the image or mounted volume at that path.

Example fix

# before
flink run -c MainClass app.jar -C libs/my-connector.jar   # file missing on cluster

# after: bundle the connector in the uber jar, or upload it with the job
flink run -c MainClass app-with-deps.jar
Defensive patterns

Strategy: validation

Validate before calling

Path p = Paths.get(jarUrl.toURI());
if (!Files.exists(p)) {
    throw new FileNotFoundException("Jar not found on this node: " + p.toAbsolutePath());
}
JarUtils.checkJarFile(jarUrl);

Prevention

When it happens

Trigger: Calling checkJarFile (or a wrapper like ClientUtils, LiquibaseSqlProgram, or -C/-pyexecjar processing that resolves jar paths) with a URL/absolute path naming a file that does not exist on the node performing the check.

Common situations: Relative jar path resolved against the wrong working directory on a remote JobManager; typo in the -C or --jar argument; jar deleted or never uploaded to the cluster (path valid locally but absent on the server); container image missing the dependency.

Related errors


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