apache/seatunnel · error · SeaTunnelEngineException
get job state error
Error message
get job state error
What it means
getJobDetailState is queried asynchronously through jobHistoryService; if the future throws (failure inside getJobDetailState or while reading the history IMap), it is rethrown as a SeaTunnelEngineException with this message. The caller cannot obtain the job's state, so the wait-for-job API errors instead of returning a JobResult.
Source
Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1556
executorService));
}
return new PassiveCompletableFuture<>(voidCompletableFuture);
}
public PassiveCompletableFuture<JobResult> waitForJobComplete(long jobId) {
// must wait for all job restore complete
restoreAllJobFromMasterNodeSwitchFuture.join();
JobMaster runningJobMaster = getJobMaster(jobId);
if (runningJobMaster == null) {
// Because operations on Imap cannot be performed within Operation.
CompletableFuture<JobHistoryService.JobState> jobStateFuture =
CompletableFuture.supplyAsync(
() -> jobHistoryService.getJobDetailState(jobId), executorService);
JobHistoryService.JobState jobState = null;
try {
jobState = jobStateFuture.get();
} catch (Exception e) {
throw new SeaTunnelEngineException("get job state error", e);
}
CompletableFuture<JobResult> future = new CompletableFuture<>();
if (jobState == null) {
future.complete(new JobResult(JobStatus.UNKNOWABLE, null));
} else {
future.complete(new JobResult(jobState.getJobStatus(), jobState.getErrorMessage()));
}
return new PassiveCompletableFuture<>(future);
} else {
return new PassiveCompletableFuture<>(runningJobMaster.getJobMasterCompleteFuture());
}
}
public PassiveCompletableFuture<Void> cancelJob(long jobId) {
JobMaster runningJobMaster = getJobMaster(jobId);
if (runningJobMaster == null) {
CompletableFuture<Void> future = new CompletableFuture<>();View on GitHub (pinned to cf67b549a7)
Solutions
- Read the caused-by exception to identify the underlying failure in getJobDetailState.
- Retry the query with backoff; transient IMap/cluster issues usually clear once the cluster is stable.
- Verify the jobId exists in job history (getJobMetrics) before waiting on its detailed state.
- Check cluster health (member liveness, IMap connectivity); restore history data if corrupted.
Example fix
// before
JobResult result = coordinatorService.waitForJobComplete(jobId).get();
// after: tolerate transient state query failure
try {
JobResult result = coordinatorService.waitForJobComplete(jobId).get();
} catch (ExecutionException e) {
if (e.getCause() instanceof SeaTunnelEngineException
&& e.getCause().getMessage().contains("get job state error")) {
Thread.sleep(5000); // retry after cluster stabilizes
} else { throw e; }
} Defensive patterns
Strategy: try-catch
Validate before calling
// confirm the job exists in history before waiting on its state
JobMetrics m = jobClient.getJobMetrics(jobId);
if (m == null || m.equals(JobMetrics.empty())) {
// job unknown; skip waiting on detailed state
} Try / catch
try {
JobResult result = coordinatorService.waitForJobComplete(jobId).get();
} catch (ExecutionException e) {
if (e.getCause() instanceof SeaTunnelEngineException
&& e.getCause().getMessage().contains("get job state error")) {
// retry with backoff, or fall back to getJobMetrics for status
} else { throw e; }
} Prevention
- Avoid querying job state during cluster shutdown or membership changes.
- Retry state queries with backoff on transient IMap errors.
- Keep job history retention enabled until consumers finish reading state.
- Monitor cluster health to detect partitions that break IMap access.
When it happens
Trigger: Calling waitForJobComplete / getJobResult APIs when jobHistoryService.getJobDetailState(jobId) throws — e.g. IMap access failure, concurrent cleanup of history records, or executor rejection.
Common situations: Querying job state during cluster shutdown or a network partition; history records concurrently removed while read; serialization issues in stored job state data.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Job is trying to leave terminal state ${current}
- Unknown Job State: ${jobStatus}
- ${CONNECTOR_JAR_HA_STORAGE_TYPE} must in [localfile, hdfs]
- Failed to call factoryIdentifier method.
- Could not find any factories that implement '${factoryClass}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e32eaf186d7184b8.
Report an issue: GitHub.