apache/flink · warning · JobStateUnknownException

Result for Job %s is UNKNOWN

Error message

Result for Job %s is UNKNOWN

What it means

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.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java:1030

    private static class JobStateUnknownException extends RuntimeException {
        public JobStateUnknownException(String message) {
            super(message);
        }
    }

    private CompletableFuture<JobResult> requestJobResultInternal(@Nonnull JobID jobId) {
        return pollResourceAsync(
                        () -> {
                            final JobMessageParameters messageParameters =
                                    new JobMessageParameters();
                            messageParameters.jobPathParameter.resolve(jobId);
                            return sendRequest(
                                    JobExecutionResultHeaders.getInstance(), messageParameters);
                        })
                .thenApply(
                        jobResult -> {
                            if (jobResult.getJobStatus().isEmpty()) {
                                throw new JobStateUnknownException(
                                        String.format("Result for Job %s is UNKNOWN", jobId));
                            }
                            return jobResult;
                        });
    }

    private <
                    M extends MessageHeaders<EmptyRequestBody, P, U>,
                    U extends MessageParameters,
                    P extends ResponseBody>
            CompletableFuture<P> sendRequest(M messageHeaders, U messageParameters) {
        return sendRequest(messageHeaders, messageParameters, EmptyRequestBody.getInstance());
    }

    private <
                    M extends MessageHeaders<R, P, EmptyMessageParameters>,
                    R extends RequestBody,
                    P extends ResponseBody>

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Enable HA mode (high-availability: zookeeper/kubernetes) so job results survive JobManager restarts.
  2. Verify the job ID is correct and was submitted to the current cluster.
  3. Check if the job result retention period (jobmanager.archive.fs.retention.duration) has expired.
  4. If non-HA, restart the job and track results within the retention window.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    JobResult result = client.requestJobResult(jobId).get();
} catch (ExecutionException e) {
    Throwable cause = ExceptionUtils.stripExecutionException(e);
    if (cause instanceof RestClusterClient.JobStateUnknownException) {
        // job result unknown — JM may have restarted without HA
        log.error("Job result for {} is unknown. Check JM HA configuration.", jobId);
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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