{"record":{"id":"b9dd5f87f327b3bf","repo":"apache/flink","slug":"no-manifest-found-in-jar-file-jarfile-getpath","errorCode":null,"errorMessage":"No manifest found in jar file '{jarFile.getPath()}'. The manifest is need to point to the program's main class.","messagePattern":"No manifest found in jar file '(.+?)'\\. The manifest is need to point to the program's main class\\.","errorType":"exception","errorClass":"ProgramInvocationException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java","lineNumber":422,"sourceCode":"                    ioex);\n        }\n\n        // jar file must be closed at the end\n        try {\n            // Read from jar manifest\n            try {\n                manifest = jar.getManifest();\n            } catch (IOException ioex) {\n                throw new ProgramInvocationException(\n                        \"The Manifest in the jar file could not be accessed '\"\n                                + jarFile.getPath()\n                                + \"'. \"\n                                + ioex.getMessage(),\n                        ioex);\n            }\n\n            if (manifest == null) {\n                throw new ProgramInvocationException(\n                        \"No manifest found in jar file '\"\n                                + jarFile.getPath()\n                                + \"'. The manifest is need to point to the program's main class.\");\n            }\n\n            Attributes attributes = manifest.getMainAttributes();\n\n            // check for a \"program-class\" entry first\n            className = attributes.getValue(PackagedProgram.MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS);\n            if (className != null) {\n                return className;\n            }\n\n            // check for a main class\n            className = attributes.getValue(PackagedProgram.MANIFEST_ATTRIBUTE_MAIN_CLASS);\n            if (className != null) {\n                return className;\n            } else {","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L404-L440","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the entry class explicitly via --class <fully.qualified.MainClass> when running the job.","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.","For Maven, configure maven-shade-plugin or maven-jar-plugin with mainClass."],"exampleFix":"# before: no entry class, jar has no manifest\nflink run /opt/jobs/myjob.jar\n\n# after: supply the entry class explicitly\nflink run -c com.example.MyJob /opt/jobs/myjob.jar","handlingStrategy":"validation","validationCode":"boolean hasManifest;\ntry (JarFile jf = new JarFile(jarFile)) {\n    hasManifest = jf.getManifest() != null;\n}\nif (!hasManifest) {\n    // require an explicit --class at submission, or rebuild with a manifest\n}","typeGuard":null,"tryCatchPattern":"try {\n    PackagedProgram.newBuilder().setJarFile(jarFile).build();\n} catch (ProgramInvocationException pie) {\n    if (pie.getMessage().contains(\"No manifest found\")) {\n        // supply entry class via .setEntryPointClassName(cls) or rebuild jar\n    }\n    throw pie;\n}","preventionTips":["Configure maven-shade-plugin / maven-jar-plugin to always emit a manifest with mainClass.","Pass --class explicitly when the jar is not self-describing.","Run 'jar tf <jar> | grep META-INF/MANIFEST.MF' to confirm a manifest exists."],"tags":["packaged-program","jar","manifest","entry-point"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}