apache/flink · error · ProgramInvocationException

The Manifest in the jar file could not be accessed '{jarFile

Error message

The Manifest in the jar file could not be accessed '{jarFile.getPath()}'. {ioex.getMessage()}

What it means

Thrown by getEntryPointClassNameFromJar when jar.getManifest() raises an IOException. The jar opened successfully but the META-INF/MANIFEST.MF entry could not be read — typically because the manifest is malformed or the central-directory entry is corrupt.

Source

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

        } catch (URISyntaxException use) {
            throw new ProgramInvocationException(
                    "Invalid file path '" + jarFile.getPath() + "'", use);
        } catch (IOException ioex) {
            throw new ProgramInvocationException(
                    "Error while opening jar file '"
                            + jarFile.getPath()
                            + "'. "
                            + ioex.getMessage(),
                    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);

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Inspect the appended ': <message>' for the manifest read error detail.
  2. Rebuild the jar with a standard build tool (Maven shade/assembly, Gradle ShadowJar) to regenerate a valid manifest.
  3. Open the jar with 'unzip -p <jar> META-INF/MANIFEST.MF' to inspect the manifest bytes for corruption.
  4. If the jar is third-party, obtain a clean copy.
Defensive patterns

Strategy: validation

Validate before calling

// Read the manifest entry independently to validate it
try (JarFile jf = new JarFile(jarFile)) {
    Manifest m = jf.getManifest();
    if (m == null) throw new IllegalStateException("No manifest");
    if (m.getMainAttributes().getValue("Main-Class") == null
        && m.getMainAttributes().getValue("program-class") == null) {
        // no entry point attribute
    }
} catch (IOException ioe) {
    throw new IllegalStateException("Manifest unreadable", ioe);
}

Try / catch

try {
    PackagedProgram.newBuilder().setJarFile(jarFile).build();
} catch (ProgramInvocationException pie) {
    if (pie.getMessage().contains("Manifest in the jar file could not be accessed")) {
        // rebuild jar with a valid manifest
    }
    throw pie;
}

Prevention

When it happens

Trigger: The jar is a valid ZIP but its MANIFEST.MF is unreadable: corrupt manifest bytes, truncated manifest entry, or a manifest that violates the JAR spec badly enough to break the reader.

Common situations: A jar assembled by a buggy build tool, a manifest concatenated incorrectly, or a jar modified by a tool that corrupted META-INF. Distinct from a missing manifest (error 77).

Related errors


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