{"record":{"id":"76096a76da401000","repo":"apache/flink","slug":"neither-a-manifest-attribute-main-class-nor-a","errorCode":null,"errorMessage":"Neither a '{MANIFEST_ATTRIBUTE_MAIN_CLASS}', nor a '{MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS}' entry was found in the jar file.","messagePattern":"Neither a '(.+?)', nor a '(.+?)' entry was found in the jar file\\.","errorType":"exception","errorClass":"ProgramInvocationException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java","lineNumber":441,"sourceCode":"                        \"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 {\n                throw new ProgramInvocationException(\n                        \"Neither a '\"\n                                + MANIFEST_ATTRIBUTE_MAIN_CLASS\n                                + \"', nor a '\"\n                                + MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS\n                                + \"' entry was found in the jar file.\");\n            }\n        } finally {\n            try {\n                jar.close();\n            } catch (Throwable t) {\n                throw new ProgramInvocationException(\n                        \"Could not close the JAR file: \" + t.getMessage(), t);\n            }\n        }\n    }\n\n    @Nullable\n    private static URL loadJarFile(File jar) throws ProgramInvocationException {","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L423-L459","documentation":"Thrown by getEntryPointClassNameFromJar when the manifest is present but contains neither Flink's 'program-class' attribute nor the standard Java 'Main-Class' attribute. The manifest exists but does not declare an entry point, so Flink cannot determine the driver class.","triggerScenarios":"The jar's META-INF/MANIFEST.MF exists but has no 'program-class' and no 'Main-Class' header. Checked in order: program-class first, then Main-Class.","commonSituations":"A library jar that has a manifest (e.g. for vendor metadata) but was never configured as an executable jar; a manifest whose main-class was set under a different/custom attribute name.","solutions":["Specify the entry class explicitly with --class <fully.qualified.MainClass>.","Rebuild the jar adding 'Main-Class' to the manifest (Maven shade/jar plugin 'mainClass'), or Flink's 'program-class' attribute.","Verify the manifest attribute name matches exactly 'Main-Class' or 'program-class' (case-sensitive)."],"exampleFix":"# before: jar manifest has neither Main-Class nor program-class\nflink run /opt/jobs/myjob.jar\n\n# after (runtime): pass the class\nflink run -c com.example.MyJob /opt/jobs/myjob.jar\n\n# after (build, pom.xml)\n# <plugin><artifactId>maven-shade-plugin</artifactId>\n#   <configuration><transformers>\n#     <transformer implementation=\"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer\">\n#       <mainClass>com.example.MyJob</mainClass>\n#     </transformer>\n#   </transformers></configuration></plugin>","handlingStrategy":"validation","validationCode":"try (JarFile jf = new JarFile(jarFile)) {\n    Manifest m = jf.getManifest();\n    if (m == null\n        || (m.getMainAttributes().getValue(\"Main-Class\") == null\n            && m.getMainAttributes().getValue(\"program-class\") == null)) {\n        // jar cannot self-describe its entry point — caller must pass --class\n        throw new IllegalArgumentException(\"Jar has no Main-Class/program-class attribute\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    PackagedProgram.newBuilder().setJarFile(jarFile).build();\n} catch (ProgramInvocationException pie) {\n    if (pie.getMessage().contains(\"Neither a\")) {\n        // rebuild with Main-Class, or pass .setEntryPointClassName()\n    }\n    throw pie;\n}","preventionTips":["Set 'Main-Class' (or Flink 'program-class') in the manifest at build time.","Pass --class explicitly for jars without a self-describing manifest.","Check attribute names are exactly 'Main-Class' / 'program-class' (case-sensitive)."],"tags":["packaged-program","jar","manifest","main-class","entry-point"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}