{"record":{"id":"222b25be1e172a74","repo":"apache/flink","slug":"job-failed","errorCode":null,"errorMessage":"Job failed","messagePattern":"Job failed","errorType":"exception","errorClass":"ProgramInvocationException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/deployment/ClusterClientJobClientAdapter.java","lineNumber":129,"sourceCode":"                clusterClientProvider,\n                (clusterClient -> clusterClient.getAccumulators(jobID, classLoader)));\n    }\n\n    @Override\n    public CompletableFuture<JobExecutionResult> getJobExecutionResult() {\n        checkNotNull(classLoader);\n\n        return bridgeClientRequest(\n                clusterClientProvider,\n                (clusterClient ->\n                        clusterClient\n                                .requestJobResult(jobID)\n                                .thenApply(\n                                        (jobResult) -> {\n                                            try {\n                                                return jobResult.toJobExecutionResult(classLoader);\n                                            } catch (Throwable t) {\n                                                throw new CompletionException(\n                                                        new ProgramInvocationException(\n                                                                \"Job failed\", jobID, t));\n                                            }\n                                        })));\n    }\n\n    @Override\n    public CompletableFuture<CoordinationResponse> sendCoordinationRequest(\n            String operatorUid, CoordinationRequest request) {\n        return bridgeClientRequest(\n                clusterClientProvider,\n                clusterClient ->\n                        clusterClient.sendCoordinationRequest(jobID, operatorUid, request));\n    }\n\n    @Override\n    public void reportHeartbeat(long expiredTimestamp) {\n        bridgeClientRequest(","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/deployment/ClusterClientJobClientAdapter.java#L111-L147","documentation":"Thrown by ClusterClientJobClientAdapter.getJobExecutionResult when jobResult.toJobExecutionResult(classLoader) throws a Throwable. The JobResult object carries the serialized exception (if any) from the job's failure, and toJobExecutionResult re-throws it during deserialization. This wraps the original failure cause in a ProgramInvocationException with message 'Job failed'. This is the user-facing signal that the job did not complete successfully when using the JobClient API.","triggerScenarios":"The submitted job finished in a FAILED state due to a runtime exception in user code, a serialization error, or an operator crash. When the JobClient's getJobExecutionResult() future completes, it attempts to materialize the result and encounters the stored exception from the ArchivedExecutionGraph.","commonSituations":"User code throws an unhandled exception inside a ProcessFunction/MapFunction; OutOfMemoryError during job execution; checkpoint failure that triggers job failure; source/sink connector timeout or connection refused.","solutions":["Inspect the root cause in the ProgramInvocationException to identify the actual job failure reason","Check the JobManager logs and the Flink Web UI for the ArchivedExecutionGraph exception","Fix the underlying job logic or resource issue, then resubmit","Use jobClient.getJobStatus() to poll before calling getJobExecutionResult() if you want to handle failures gracefully"],"exampleFix":"// before\nJobExecutionResult result = jobClient.getJobExecutionResult().get();\n\n// after\ntry {\n    JobExecutionResult result = jobClient.getJobExecutionResult().get();\n} catch (ExecutionException e) {\n    if (e.getCause() instanceof ProgramInvocationException) {\n        Throwable jobFailure = e.getCause().getCause();\n        LOG.error(\"Job failed with cause:\", jobFailure);\n    }\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    JobExecutionResult result = jobClient.getJobExecutionResult().get();\n} catch (ExecutionException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof ProgramInvocationException) {\n        Throwable jobFailure = cause.getCause();\n        LOG.error(\"Job failed due to: {}\", jobFailure.getMessage(), jobFailure);\n    }\n}","preventionTips":["Check jobClient.getJobStatus() before calling getJobExecutionResult() to detect FAILED early","Inspect ArchivedExecutionGraph in the Flink Web UI for root cause","Handle the ProgramInvocationException cause chain to surface the real error to users"],"tags":["job-execution","job-client","runtime-error"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}