{"record":{"id":"f4fc9d52661e87db","repo":"apache/flink","slug":"the-jarfile-and-entrypointclassname-can-not-be-nul","errorCode":null,"errorMessage":"The jarFile and entryPointClassName can not be null at the same time.","messagePattern":"The jarFile and entryPointClassName can not be null at the same time\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java","lineNumber":697,"sourceCode":"        public Builder setConfiguration(Configuration configuration) {\n            this.configuration = configuration;\n            return this;\n        }\n\n        public Builder setSavepointRestoreSettings(\n                SavepointRestoreSettings savepointRestoreSettings) {\n            this.savepointRestoreSettings = savepointRestoreSettings;\n            return this;\n        }\n\n        @VisibleForTesting\n        public List<URL> getUserClassPaths() {\n            return userClassPaths;\n        }\n\n        public PackagedProgram build() throws ProgramInvocationException {\n            if (jarFile == null && entryPointClassName == null) {\n                throw new IllegalArgumentException(\n                        \"The jarFile and entryPointClassName can not be null at the same time.\");\n            }\n            return new PackagedProgram(\n                    jarFile,\n                    userClassPaths,\n                    entryPointClassName,\n                    configuration,\n                    savepointRestoreSettings,\n                    args);\n        }\n\n        private Builder() {}\n    }\n\n    public static Builder newBuilder() {\n        return new Builder();\n    }\n}","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L679-L715","documentation":"Thrown by PackagedProgram.Builder.build() when both jarFile and entryPointClassName are null. The builder requires at least one of these to construct a program — a jar to infer the main class from, or an explicit entry point class name.","triggerScenarios":"Calling PackagedProgram.newBuilder().build() without calling setJarFile or setEntryPointClassName (or calling only configuration/savepoint setters). This is an IllegalArgumentException indicating a contract violation.","commonSituations":"Programmatic builder usage where conditional logic skipped both setters, or a copy-paste error that removed the setJarFile call.","solutions":["Provide a jar file via setJarFile(URI) or setJarFile(File).","Or provide an entry point class name via setEntryPointClassName(String).","Review builder call chain to ensure at least one is set before build()."],"exampleFix":"// before\nPackagedProgram.newBuilder()\n    .setConfiguration(conf)\n    .build();  // both jarFile and entryPointClassName are null\n\n// after\nPackagedProgram.newBuilder()\n    .setJarFile(jarFile)\n    .setConfiguration(conf)\n    .build();","handlingStrategy":"validation","validationCode":"if (jarFile == null && entryPointClassName == null) {\n    throw new IllegalArgumentException(\n        \"Must provide either a jar file or an entry point class name.\");\n}\nPackagedProgram.newBuilder()\n    .setJarFile(jarFile)\n    .setEntryPointClassName(entryPointClassName)\n    .build();","typeGuard":null,"tryCatchPattern":"try {\n    PackagedProgram.newBuilder().build();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"can not be null at the same time\")) {\n        // set jarFile or entryPointClassName before build\n    }\n    throw e;\n}","preventionTips":["Always call setJarFile or setEntryPointClassName before build().","Use a builder validation step or unit test to catch missing required fields."],"tags":["packaged-program","builder","validation","argument"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}