apache/flink · error · IllegalArgumentException
The jarFile and entryPointClassName can not be null at the s
Error message
The jarFile and entryPointClassName can not be null at the same time.
What it means
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.
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java:697
public Builder setConfiguration(Configuration configuration) {
this.configuration = configuration;
return this;
}
public Builder setSavepointRestoreSettings(
SavepointRestoreSettings savepointRestoreSettings) {
this.savepointRestoreSettings = savepointRestoreSettings;
return this;
}
@VisibleForTesting
public List<URL> getUserClassPaths() {
return userClassPaths;
}
public PackagedProgram build() throws ProgramInvocationException {
if (jarFile == null && entryPointClassName == null) {
throw new IllegalArgumentException(
"The jarFile and entryPointClassName can not be null at the same time.");
}
return new PackagedProgram(
jarFile,
userClassPaths,
entryPointClassName,
configuration,
savepointRestoreSettings,
args);
}
private Builder() {}
}
public static Builder newBuilder() {
return new Builder();
}
}View on GitHub (pinned to 2f3c205e92)
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().
Example fix
// before
PackagedProgram.newBuilder()
.setConfiguration(conf)
.build(); // both jarFile and entryPointClassName are null
// after
PackagedProgram.newBuilder()
.setJarFile(jarFile)
.setConfiguration(conf)
.build(); Defensive patterns
Strategy: validation
Validate before calling
if (jarFile == null && entryPointClassName == null) {
throw new IllegalArgumentException(
"Must provide either a jar file or an entry point class name.");
}
PackagedProgram.newBuilder()
.setJarFile(jarFile)
.setEntryPointClassName(entryPointClassName)
.build(); Try / catch
try {
PackagedProgram.newBuilder().build();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("can not be null at the same time")) {
// set jarFile or entryPointClassName before build
}
throw e;
} Prevention
- Always call setJarFile or setEntryPointClassName before build().
- Use a builder validation step or unit test to catch missing required fields.
When it happens
Trigger: Calling PackagedProgram.newBuilder().build() without calling setJarFile or setEntryPointClassName (or calling only configuration/savepoint setters). This is an IllegalArgumentException indicating a contract violation.
Common situations: Programmatic builder usage where conditional logic skipped both setters, or a copy-paste error that removed the setJarFile call.
Related errors
- {e.getMessage()}
- Cannot access jar file{t.getMessage() == null ? "." : ": " +
- At least one trigger condition must be configured.
- The cpu cores should be positive.
- The cpu cores and task heap memory are required when specify
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/f4fc9d52661e87db.
Report an issue: GitHub.