apache/flink · error · CompletionException
Failed to submit ExecutionPlan.
Error message
Failed to submit ExecutionPlan.
What it means
The top-level failure handler for RestClusterClient.submitJob. Any exception that occurs during the entire submission chain (serialization, artifact upload, HTTP request, server response) is caught by the .exceptionally() block and rethrown as a JobSubmissionException. ExceptionUtils.stripCompletionException unwraps nested CompletionExceptions so the root cause surfaces.
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java:497
.exceptionally(ignored -> null) // ignore errors
.thenCompose(ignored -> executionPlanFileFuture)
.thenAccept(
executionPlanFile -> {
try {
Files.delete(executionPlanFile);
} catch (IOException e) {
LOG.warn(
"Could not delete temporary file {}.",
executionPlanFile,
e);
}
});
return submissionFuture
.thenApply(ignore -> executionPlan.getJobID())
.exceptionally(
(Throwable throwable) -> {
throw new CompletionException(
new JobSubmissionException(
executionPlan.getJobID(),
"Failed to submit ExecutionPlan.",
ExceptionUtils.stripCompletionException(throwable)));
});
}
@Override
public CompletableFuture<Acknowledge> cancel(JobID jobID) {
JobCancellationMessageParameters params =
new JobCancellationMessageParameters()
.resolveJobId(jobID)
.resolveTerminationMode(
TerminationModeQueryParameter.TerminationMode.CANCEL);
CompletableFuture<EmptyResponseBody> responseFuture =
sendRequest(JobCancellationHeaders.getInstance(), params);
return responseFuture.thenApply(ignore -> Acknowledge.get());
}View on GitHub (pinned to 2f3c205e92)
Solutions
- Inspect the wrapped cause (ExceptionUtils.stripCompletionException output) — it identifies whether the failure is network, serialization, or server-side.
- Verify the JobManager REST address and port are correct and reachable: curl http://<jm-host>:<rest-port>/overview.
- Check the JobManager logs for the corresponding rejection or error.
- If the error is a payload-size issue, reduce the number of user jars/artifacts or their size.
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify JobManager is reachable before submitting
try {
URL restUrl = new URL("http://" + jmHost + ":" + restPort + "/overview");
HttpURLConnection conn = (HttpURLConnection) restUrl.openConnection();
conn.setConnectTimeout(5000);
if (conn.getResponseCode() != 200) {
throw new IllegalStateException("JobManager REST endpoint not available");
}
} catch (IOException e) {
throw new IllegalStateException("Cannot reach JobManager at " + jmHost + ":" + restPort, e);
} Try / catch
try {
JobID jobId = client.submitJob(executionPlan).get(60, TimeUnit.SECONDS);
} catch (ExecutionException e) {
Throwable cause = ExceptionUtils.stripExecutionException(e);
if (cause instanceof JobSubmissionException) {
// inspect cause.getCause() for root reason (network, serialization, server rejection)
log.error("Job submission failed: {}", cause.getCause().getMessage());
}
} Prevention
- Verify JobManager REST endpoint connectivity before submitting.
- Ensure client and cluster Flink versions match.
- Keep user jar and artifact sizes within REST payload limits.
When it happens
Trigger: The REST POST to the JobManager /jars/upload or /job/submit endpoint fails with a non-2xx status; a network timeout or connection refused between client and JobManager; a preceding CompletableFuture in the chain (executionPlanFileFuture, requestFuture) completes exceptionally.
Common situations: JobManager is not running or is unreachable; REST port is firewalled; the submitted job graph is too large for the REST request body limit; authentication/TLS mismatch between client and cluster; job was rejected by the JobManager due to invalid graph or quota.
Related errors
- Failed to serialize ExecutionPlan.
- Failed to get the FileSystem of artifact {artifactFilePath}.
- Java program should be specified a JAR file.
- Couldn't retrieve standalone cluster
- {checkpointInfo.getFailureCause()}
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/8bf74640ecaae287.
Report an issue: GitHub.