apache/flink · error · ProgramInvocationException

No manifest found in jar file '{jarFile.getPath()}'. The man

Error message

No manifest found in jar file '{jarFile.getPath()}'. The manifest is need to point to the program's main class.

What it means

Thrown by getEntryPointClassNameFromJar when jar.getManifest() returns null — i.e. the jar has no META-INF/MANIFEST.MF entry at all. Without a manifest, Flink cannot discover the entry point class automatically and requires the user to specify --class.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java:422

                    ioex);
        }

        // jar file must be closed at the end
        try {
            // Read from jar manifest
            try {
                manifest = jar.getManifest();
            } catch (IOException ioex) {
                throw new ProgramInvocationException(
                        "The Manifest in the jar file could not be accessed '"
                                + jarFile.getPath()
                                + "'. "
                                + ioex.getMessage(),
                        ioex);
            }

            if (manifest == null) {
                throw new ProgramInvocationException(
                        "No manifest found in jar file '"
                                + jarFile.getPath()
                                + "'. The manifest is need to point to the program's main class.");
            }

            Attributes attributes = manifest.getMainAttributes();

            // check for a "program-class" entry first
            className = attributes.getValue(PackagedProgram.MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS);
            if (className != null) {
                return className;
            }

            // check for a main class
            className = attributes.getValue(PackagedProgram.MANIFEST_ATTRIBUTE_MAIN_CLASS);
            if (className != null) {
                return className;
            } else {

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Pass the entry class explicitly via --class <fully.qualified.MainClass> when running the job.
  2. Rebuild the jar with a manifest containing 'Main-Class' (or Flink's 'program-class') using the Maven shade/assembly plugin or jar cf with a manifest stub.
  3. For Maven, configure maven-shade-plugin or maven-jar-plugin with mainClass.

Example fix

# before: no entry class, jar has no manifest
flink run /opt/jobs/myjob.jar

# after: supply the entry class explicitly
flink run -c com.example.MyJob /opt/jobs/myjob.jar
Defensive patterns

Strategy: validation

Validate before calling

boolean hasManifest;
try (JarFile jf = new JarFile(jarFile)) {
    hasManifest = jf.getManifest() != null;
}
if (!hasManifest) {
    // require an explicit --class at submission, or rebuild with a manifest
}

Try / catch

try {
    PackagedProgram.newBuilder().setJarFile(jarFile).build();
} catch (ProgramInvocationException pie) {
    if (pie.getMessage().contains("No manifest found")) {
        // supply entry class via .setEntryPointClassName(cls) or rebuild jar
    }
    throw pie;
}

Prevention

When it happens

Trigger: The jar was built without a manifest (e.g. plain 'jar cf' with no manifest, or a build that excluded it), and no explicit entryPointClassName was supplied.

Common situations: Submitting a plain library jar that was never configured as an executable jar; submitting a jar built by a tool that does not add a manifest by default.

Related errors


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