{"record":{"id":"a891fa3863f5dc61","repo":"apache/flink","slug":"result-for-job-s-is-unknown","errorCode":null,"errorMessage":"Result for Job %s is UNKNOWN","messagePattern":"Result for Job (.+?) is UNKNOWN","errorType":"exception","errorClass":"JobStateUnknownException","httpStatus":null,"severity":"warning","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java","lineNumber":1030,"sourceCode":"    private static class JobStateUnknownException extends RuntimeException {\n        public JobStateUnknownException(String message) {\n            super(message);\n        }\n    }\n\n    private CompletableFuture<JobResult> requestJobResultInternal(@Nonnull JobID jobId) {\n        return pollResourceAsync(\n                        () -> {\n                            final JobMessageParameters messageParameters =\n                                    new JobMessageParameters();\n                            messageParameters.jobPathParameter.resolve(jobId);\n                            return sendRequest(\n                                    JobExecutionResultHeaders.getInstance(), messageParameters);\n                        })\n                .thenApply(\n                        jobResult -> {\n                            if (jobResult.getJobStatus().isEmpty()) {\n                                throw new JobStateUnknownException(\n                                        String.format(\"Result for Job %s is UNKNOWN\", jobId));\n                            }\n                            return jobResult;\n                        });\n    }\n\n    private <\n                    M extends MessageHeaders<EmptyRequestBody, P, U>,\n                    U extends MessageParameters,\n                    P extends ResponseBody>\n            CompletableFuture<P> sendRequest(M messageHeaders, U messageParameters) {\n        return sendRequest(messageHeaders, messageParameters, EmptyRequestBody.getInstance());\n    }\n\n    private <\n                    M extends MessageHeaders<R, P, EmptyMessageParameters>,\n                    R extends RequestBody,\n                    P extends ResponseBody>","sourceCodeStart":1012,"sourceCodeEnd":1048,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L1012-L1048","documentation":"Thrown as a JobStateUnknownException when requestJobResultInternal receives a JobResult from the REST endpoint but its job status is empty (isEmpty() returns true). This means the JobManager could not determine the final execution result — the job result object has no status information. This typically happens when the job has been cleaned up from the JobManager's memory or was never known to this JobManager instance.","triggerScenarios":"Polling for job result via requestJobResult(jobId) after the JobManager has lost track of the job (post-restart without HA), or the job ID was never submitted to this cluster.","commonSituations":"JobManager restarted without HA mode enabled, losing all in-memory job results; the job ID is incorrect or belongs to a different cluster; job result was garbage-collected after the result retention period expired; requesting results for a job submitted to a different JobManager in a non-HA setup.","solutions":["Enable HA mode (high-availability: zookeeper/kubernetes) so job results survive JobManager restarts.","Verify the job ID is correct and was submitted to the current cluster.","Check if the job result retention period (jobmanager.archive.fs.retention.duration) has expired.","If non-HA, restart the job and track results within the retention window."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    JobResult result = client.requestJobResult(jobId).get();\n} catch (ExecutionException e) {\n    Throwable cause = ExceptionUtils.stripExecutionException(e);\n    if (cause instanceof RestClusterClient.JobStateUnknownException) {\n        // job result unknown — JM may have restarted without HA\n        log.error(\"Job result for {} is unknown. Check JM HA configuration.\", jobId);\n    }\n}","preventionTips":["Enable HA mode (ZooKeeper/Kubernetes) so job results survive JM restarts.","Poll for job results within the configured retention window.","Verify the job ID was submitted to the current cluster."],"tags":["job-result","rest-client","unknown-state","ha"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}