apache/seatunnel · error · TaskGroupContextNotFoundException
task group %s not found.
Error message
task group %s not found.
What it means
TaskExecutionService.getExecutionContext throws TaskGroupContextNotFoundException when no execution context (running or finished) exists for the requested TaskGroupLocation. It means this worker never deployed that task group, or its context was already removed after completion/cleanup.
Source
Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/TaskExecutionService.java:316
timerFlushWorker.shutdown();
}
/**
* Gets the execution context for a task group. First checks active execution contexts, then
* falls back to finished execution contexts.
*
* @param taskGroupLocation the location of the task group
* @return the TaskGroupContext for the task group
* @throws TaskGroupContextNotFoundException if the task group is not found
*/
public TaskGroupContext getExecutionContext(TaskGroupLocation taskGroupLocation) {
TaskGroupContext taskGroupContext = executionContexts.get(taskGroupLocation);
if (taskGroupContext == null) {
taskGroupContext = finishedExecutionContexts.get(taskGroupLocation);
}
if (taskGroupContext == null) {
throw new TaskGroupContextNotFoundException(
String.format("task group %s not found.", taskGroupLocation));
}
return taskGroupContext;
}
/**
* Gets the active execution context for a task group. Only checks active execution contexts,
* does not check finished contexts.
*
* @param taskGroupLocation the location of the task group
* @return the TaskGroupContext for the task group
* @throws TaskGroupContextNotFoundException if the task group is not found or not active
*/
public TaskGroupContext getActiveExecutionContext(TaskGroupLocation taskGroupLocation) {
TaskGroupContext taskGroupContext = executionContexts.get(taskGroupLocation);
if (taskGroupContext == null) {
throw new TaskGroupContextNotFoundException(View on GitHub (pinned to cf67b549a7)
Solutions
- Confirm the task group was actually deployed to this worker (check the worker log for the corresponding deploy/deployment message for that TaskGroupLocation).
- If the node restarted, let the coordinator failover logic redeploy the task group (retrigger the job or wait for its retry).
- Check for version mismatches between coordinator and worker (same SeaTunnel version) — mismatched TaskGroupLocation serialization can cause lookups with stale IDs.
- If the task already finished, the context was legitimately removed; the caller should treat this as a finished task and stop sending control operations.
Defensive patterns
Strategy: try-catch
Validate before calling
// coordinator side: ensure the deploy operation for this TaskGroupLocation completed before sending control ops
Type guard
TaskGroupContext ctx = executionContexts.get(loc); if (ctx == null) ctx = finishedExecutionContexts.get(loc); if (ctx == null) return null; // caller decides to skip/redeploy
Try / catch
try {
return taskExecutionService.getExecutionContext(taskGroupLocation);
} catch (TaskGroupContextNotFoundException e) {
log.warn("Task group {} unknown on this worker (deployed elsewhere or cleaned up)", taskGroupLocation);
throw e;
} Prevention
- Ensure control operations are only sent to the worker that deployed the task group
- After node restart, rely on coordinator failover to redeploy task groups before control ops
- Stop sending control operations once a task group reaches a terminal state
- Run identical SeaTunnel versions on all nodes
When it happens
Trigger: runControlDeployment / runOnePrePublicationFailureAttempt / taskClassLoader (classloader lookups during task execution) asking for a TaskGroupLocation that is absent from both executionContexts and finishedExecutionContexts maps — e.g. after TaskExecutionService cleanup, node restart, or a stale/mismatched task group location sent by the coordinator.
Common situations: Coordinator failover sending control operations to a worker whose local task group was already cleaned up; duplicate or outdated task-group notifications after a task finished; node restarted mid-job and receiving operations for pre-restart task groups.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Job %s not running
- Job %s not found
- Job %s not running (restore in progress)
- The user is not configured to enable connector package servi
- This is not a master node now.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/4189036b64050ff3.
Report an issue: GitHub.