{"record":{"id":"3ab8fa91fa5e524c","repo":"apache/seatunnel","slug":"failed-to-fetch-job-result","errorCode":null,"errorMessage":"failed to fetch job result","messagePattern":"failed to fetch job result","errorType":"exception","errorClass":"SeaTunnelEngineException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-client/src/main/java/org/apache/seatunnel/engine/client/job/ClientJobProxy.java","lineNumber":108,"sourceCode":"     * @return The job final status\n     */\n    @Override\n    public JobResult waitForJobCompleteV2() {\n        try {\n            jobResult =\n                    RetryUtils.retryWithException(\n                            () -> {\n                                PassiveCompletableFuture<JobResult> jobFuture =\n                                        doWaitForJobComplete();\n                                return jobFuture.get();\n                            },\n                            new RetryUtils.RetryMaterial(\n                                    100000,\n                                    true,\n                                    ExceptionUtil::isOperationNeedRetryException,\n                                    Constant.OPERATION_RETRY_SLEEP));\n            if (jobResult == null) {\n                throw new SeaTunnelEngineException(\"failed to fetch job result\");\n            }\n        } catch (Exception e) {\n            LOGGER.severe(\n                    String.format(\n                            \"Job (%s) end with unknown state, and throw Exception: %s\",\n                            jobId, ExceptionUtils.getMessage(e)));\n            throw new RuntimeException(e);\n        }\n        LOGGER.info(String.format(\"Job (%s) end with state %s\", jobId, jobResult.getStatus()));\n        return jobResult;\n    }\n\n    public JobResult getJobResultCache() {\n        return jobResult;\n    }\n\n    @Override\n    public PassiveCompletableFuture<JobResult> doWaitForJobComplete() {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-client/src/main/java/org/apache/seatunnel/engine/client/job/ClientJobProxy.java#L90-L126","documentation":"ClientJobProxy.waitForJobCompleteV2 polls the Zeta master for the final job result using RetryUtils (100000 attempts, retrying only on operation-need-retry exceptions). If the retried fetch still returns null, it throws SeaTunnelEngineException(\"failed to fetch job result\"), i.e. the master never produced a terminal state for the job.","triggerScenarios":"jobResult() -> waitForJobCompleteV2 where the retried fetch returns null or a non-retryable exception is caught: master restarted/crashed mid-job, job state expired and cleaned up, sustained client-master connection failures, or the jobId never existed on this cluster.","commonSituations":"Zeta master restart during a long job; historyJobExpireMinutes / state cleanup too small so the job record vanishes before the client asks; network instability exhausting retries; client pointed at the wrong cluster.","solutions":["Check Zeta master logs and cluster stability for the job's lifetime.","Raise historyJobExpireMinutes / state cleanup delay so results outlive slow clients.","Verify client-to-master connectivity and retry jobResult after the connection recovers.","Fetch the result/status from job history or persistent storage if the job already finished."],"exampleFix":"// before\nJobResult r = jobProxy.waitForJobCompleteV2(); // may throw\n// after\nJobResult r;\ntry {\n    r = jobProxy.waitForJobCompleteV2();\n} catch (SeaTunnelEngineException e) {\n    LOG.warning(\"job result unavailable from master: \" + e.getMessage());\n    r = fetchResultFromHistory(jobId);\n}","handlingStrategy":"try-catch","validationCode":"if (!clusterHealthy()) {\n    throw new IllegalStateException(\"master unavailable; refusing to block on job result\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    JobResult r = jobProxy.waitForJobCompleteV2();\n} catch (SeaTunnelEngineException e) {\n    LOGGER.warning(\"job \" + jobId + \" result unavailable: \" + e.getMessage());\n    // check master state / history, then decide retry vs fail\n}","preventionTips":["Keep master stable and reachable for the full job duration.","Set historyJobExpireMinutes / state cleanup long enough to outlive slow clients.","Persist job results externally for long-lived access.","Monitor master restarts and client-master connectivity."],"tags":["engine","master","job-result"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}