apache/seatunnel · error · UnsupportedOperationException

Unsupported close starting task

Error message

Unsupported close starting task

What it means

CheckpointCoordinator.readyToCloseIdleTask handles close requests for idle (non-starting) tasks; if the requested TaskLocation is one of the plan's starting subtasks, it throws UnsupportedOperationException because starting tasks must be closed through the dedicated readyToCloseStartingTask path, not the idle-task path. This is a protocol misuse guard, not a runtime failure.

Source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinator.java:622

                            true,
                            ExceptionUtil::isOperationNeedRetryException,
                            Constant.OPERATION_RETRY_SLEEP));
        } catch (Exception e) {
            LOG.error(
                    "Failed to persist readyToCloseStartingTask to IMap after retries, key: {}."
                            + " Failing the job to avoid an unrecoverable stuck state on master failover.",
                    readyToCloseImapKey,
                    e);
            throw new RuntimeException(
                    "Failed to persist readyToCloseStartingTask to IMap, key: "
                            + readyToCloseImapKey,
                    e);
        }
    }

    protected void readyToCloseIdleTask(TaskLocation taskLocation) {
        if (plan.getStartingSubtasks().contains(taskLocation)) {
            throw new UnsupportedOperationException("Unsupported close starting task");
        }

        LOG.info(
                "Received close idle task, task id: {}, pipeline id: {}, job id: {}, detail: {}",
                taskLocation.getTaskID(),
                taskLocation.getPipelineId(),
                taskLocation.getJobId(),
                taskLocation);
        synchronized (readyToCloseIdleTask) {
            if (readyToCloseIdleTask.contains(taskLocation)
                    || closedIdleTask.contains(taskLocation)) {
                LOG.warn(
                        "task already in closed, task id: {}, pipeline id: {}, job id: {}, detail: {}",
                        taskLocation.getTaskID(),
                        taskLocation.getPipelineId(),
                        taskLocation.getJobId(),
                        taskLocation);
                return;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Route close requests for starting subtasks through readyToClose (the starting-task path) instead of readyToCloseIdleTask
  2. Check plan.getStartingSubtasks() and branch before invoking the idle-task handler
  3. If seen in stock SeaTunnel, capture job/pipeline/task IDs and report — it likely indicates an internal routing bug
  4. Ensure connectors don't emit close-completion signals for source tasks through the idle notification channel

Example fix

// before
coordinator.readyToCloseIdleTask(taskLocation); // may be a starting task

// after
if (plan.getStartingSubtasks().contains(taskLocation)) {
    coordinator.readyToCloseStartingTask(taskLocation);
} else {
    coordinator.readyToCloseIdleTask(taskLocation);
}
Defensive patterns

Strategy: validation

Validate before calling

if (plan.getStartingSubtasks().contains(taskLocation)) {
    throw new IllegalArgumentException("use readyToClose for starting task " + taskLocation);
}

Type guard

boolean isStartingTask(TaskLocation loc) { return plan.getStartingSubtasks().contains(loc); }

Try / catch

try {
    coordinator.readyToCloseIdleTask(taskLocation);
} catch (UnsupportedOperationException e) {
    coordinator.readyToCloseStartingTask(taskLocation);
}

Prevention

When it happens

Trigger: Calling readyToCloseIdleTask(taskLocation) where taskLocation is contained in plan.getStartingSubtasks() — i.e., a source/starting task's close notification routed through the idle-task handler.

Common situations: Custom checkpoint/task lifecycle code or a patched connector sending close signals for source tasks via the wrong API; internal routing bugs in the close protocol; manually replaying close messages against the coordinator.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/82e5af8e4231542c. Report an issue: GitHub.