apache/dolphinscheduler · warning · ServiceException

TASK_GROUP_QUEUE_ALREADY_START

TASK_GROUP_QUEUE_ALREADY_START

Error message

TASK_GROUP_QUEUE_ALREADY_START

What it means

TASK_GROUP_QUEUE_ALREADY_START is thrown by forceStartTaskInstance when the task-group queue entry has inQueue == NO, meaning the task has already acquired a task-group slot and is no longer waiting in queue, so forcing a start is unnecessary and rejected.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:380

            putMsg(response, Status.EXECUTE_WORKFLOW_INSTANCE_ERROR);
        }

        return response;
    }

    @Override
    public void forceStartTaskInstance(User loginUser, int queueId) {
        TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.selectById(queueId);
        // check workflow instance exist
        WorkflowInstance workflowInstance =
                workflowInstanceDao.queryOptionalById(taskGroupQueue.getWorkflowInstanceId())
                        .orElseThrow(
                                () -> new ServiceException(Status.WORKFLOW_INSTANCE_NOT_EXIST,
                                        taskGroupQueue.getWorkflowInstanceId()));
        projectService.checkHasProjectWritePermissionThrowException(loginUser, workflowInstance.getProjectCode());

        if (taskGroupQueue.getInQueue() == Flag.NO.getCode()) {
            throw new ServiceException(Status.TASK_GROUP_QUEUE_ALREADY_START);
        }
        taskGroupQueue.setForceStart(Flag.YES.getCode());
        taskGroupQueue.setUpdateTime(new Date());
        taskGroupQueueMapper.updateById(taskGroupQueue);
    }

    @Override
    public void execStreamTaskInstance(User loginUser,
                                       long projectCode,
                                       long taskDefinitionCode,
                                       int taskDefinitionVersion,
                                       int warningGroupId,
                                       String workerGroup,
                                       String tenantCode,
                                       Long environmentCode,
                                       Map<String, String> startParams,
                                       int dryRun) {
        throw new ServiceException("Not supported");

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Do nothing — the task already started; refresh the task group queue list to confirm.
  2. Only call force-start for entries showing inQueue=yes/waiting state.
  3. Make automation idempotent: check inQueue status before forcing and treat this error as success.

Example fix

// before
queue.forceStart(queueId); // may fail if already started
// after
TaskGroupQueue q = taskGroupQueueMapper.selectById(queueId);
if (q.getInQueue() == Flag.YES.getCode()) {
    queue.forceStart(queueId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (queue.getInQueue() == Flag.NO.getCode()) { /* skip force-start: already running */ }

Type guard

boolean isWaitingInQueue(TaskGroupQueue q) { return q != null && q.getInQueue() == Flag.YES.getCode(); }

Try / catch

try { forceStartTaskInstance(loginUser, id); } catch (ServiceException e) { if (e.getCode() == Status.TASK_GROUP_QUEUE_ALREADY_START) { /* treat as already-started: idempotent no-op */ } else throw e; }

Prevention

When it happens

Trigger: Calling forceStartTaskInstance for a taskGroupQueue whose inQueue flag is Flag.NO — the task already left the waiting queue (already started or already granted resources).

Common situations: Double-clicking 'force start' in the task group queue UI; automations retrying force-start after the task already began; race conditions where the queue drained between listing and forcing.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/ff0cb7a203a057d7. Report an issue: GitHub.