{"record":{"id":"8bf74640ecaae287","repo":"apache/flink","slug":"failed-to-submit-executionplan","errorCode":null,"errorMessage":"Failed to submit ExecutionPlan.","messagePattern":"Failed to submit ExecutionPlan\\.","errorType":"exception","errorClass":"CompletionException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java","lineNumber":497,"sourceCode":"                .exceptionally(ignored -> null) // ignore errors\n                .thenCompose(ignored -> executionPlanFileFuture)\n                .thenAccept(\n                        executionPlanFile -> {\n                            try {\n                                Files.delete(executionPlanFile);\n                            } catch (IOException e) {\n                                LOG.warn(\n                                        \"Could not delete temporary file {}.\",\n                                        executionPlanFile,\n                                        e);\n                            }\n                        });\n\n        return submissionFuture\n                .thenApply(ignore -> executionPlan.getJobID())\n                .exceptionally(\n                        (Throwable throwable) -> {\n                            throw new CompletionException(\n                                    new JobSubmissionException(\n                                            executionPlan.getJobID(),\n                                            \"Failed to submit ExecutionPlan.\",\n                                            ExceptionUtils.stripCompletionException(throwable)));\n                        });\n    }\n\n    @Override\n    public CompletableFuture<Acknowledge> cancel(JobID jobID) {\n        JobCancellationMessageParameters params =\n                new JobCancellationMessageParameters()\n                        .resolveJobId(jobID)\n                        .resolveTerminationMode(\n                                TerminationModeQueryParameter.TerminationMode.CANCEL);\n        CompletableFuture<EmptyResponseBody> responseFuture =\n                sendRequest(JobCancellationHeaders.getInstance(), params);\n        return responseFuture.thenApply(ignore -> Acknowledge.get());\n    }","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L479-L515","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify JobManager is reachable before submitting\ntry {\n    URL restUrl = new URL(\"http://\" + jmHost + \":\" + restPort + \"/overview\");\n    HttpURLConnection conn = (HttpURLConnection) restUrl.openConnection();\n    conn.setConnectTimeout(5000);\n    if (conn.getResponseCode() != 200) {\n        throw new IllegalStateException(\"JobManager REST endpoint not available\");\n    }\n} catch (IOException e) {\n    throw new IllegalStateException(\"Cannot reach JobManager at \" + jmHost + \":\" + restPort, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    JobID jobId = client.submitJob(executionPlan).get(60, TimeUnit.SECONDS);\n} catch (ExecutionException e) {\n    Throwable cause = ExceptionUtils.stripExecutionException(e);\n    if (cause instanceof JobSubmissionException) {\n        // inspect cause.getCause() for root reason (network, serialization, server rejection)\n        log.error(\"Job submission failed: {}\", cause.getCause().getMessage());\n    }\n}","preventionTips":["Verify JobManager REST endpoint connectivity before submitting.","Ensure client and cluster Flink versions match.","Keep user jar and artifact sizes within REST payload limits."],"tags":["job-submission","rest-client","network","error-handling"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}