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

  1. Inspect the wrapped cause (ExceptionUtils.stripCompletionException output) — it identifies whether the failure is network, serialization, or server-side.
  2. Verify the JobManager REST address and port are correct and reachable: curl http://<jm-host>:<rest-port>/overview.
  3. Check the JobManager logs for the corresponding rejection or error.
  4. 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

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


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/8bf74640ecaae287. Report an issue: GitHub.