apache/dolphinscheduler · error · ServiceException
10145
10145
Error message
delete worker group by id fail, for there are {0} workflow instances in executing using it What it means
Thrown in deleteWorkerGroupById when queryByWorkerGroupNameAndStatus finds non-terminal (running/pending) workflow instances whose workflow instance still uses this worker group. Deletion is blocked because live instances depend on it; the message reports how many.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java:333
public void deleteWorkerGroupById(User loginUser, Integer id) {
if (!canOperatorPermissions(loginUser, null, AuthorizationType.WORKER_GROUP, WORKER_GROUP_DELETE)) {
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
WorkerGroup workerGroup = workerGroupDao.queryById(id);
if (workerGroup == null) {
log.error("Worker group does not exist, workerGroupId:{}.", id);
throw new ServiceException(Status.DELETE_WORKER_GROUP_NOT_EXIST);
}
List<WorkflowInstanceSummaryDto> workflowInstances = workflowInstanceDao.queryByWorkerGroupNameAndStatus(
workerGroup.getName(),
WorkflowExecutionStatus.NOT_TERMINAL_STATES);
if (CollectionUtils.isNotEmpty(workflowInstances)) {
List<Integer> workflowInstanceIds =
workflowInstances.stream().map(WorkflowInstanceSummaryDto::getId).collect(Collectors.toList());
log.warn(
"Delete worker group failed because there are {} workflowInstances are using it, workflowInstanceIds:{}.",
workflowInstances.size(), workflowInstanceIds);
throw new ServiceException(Status.DELETE_WORKER_GROUP_BY_ID_FAIL, workflowInstances.size());
}
checkWorkerGroupDependencies(workerGroup);
workerGroupDao.deleteById(id);
boardCastToMasterThatWorkerGroupChanged();
log.info("Delete worker group complete, workerGroupName:{}.", workerGroup.getName());
}
/**
* query all worker address list
*
* @return all worker address set
*/
@Override
public Set<String> getWorkerAddressList() {
return registryClient.getServerNodeSet(RegistryNodeType.WORKER);View on GitHub (pinned to 02eac45a1b)
Solutions
- Wait for running workflow instances to finish or stop/kill them, then delete the worker group.
- Reassign the affected workflow/schedule definitions to another worker group and let old instances terminate.
- If instances are stale/leaked, fix their state (or let them time out) so no NOT_TERMINAL instances reference the group, then retry.
Example fix
// before workerGroupService.deleteWorkerGroupById(loginUser, id); // 10145 while jobs run // after: stop running instances first workflowInstances using the group -> stop/kill via UI or API workerGroupService.deleteWorkerGroupById(loginUser, id); // succeeds
Defensive patterns
Strategy: validation
Validate before calling
List<WorkflowInstanceSummaryDto> active = workflowInstanceDao
.queryByWorkerGroupNameAndStatus(groupName, WorkflowExecutionStatus.NOT_TERMINAL_STATES);
boolean deletable = active.isEmpty(); Try / catch
try {
workerGroupService.deleteWorkerGroupById(loginUser, id);
} catch (ServiceException e) {
if (e.getCode() == 10145) { /* stop/wait running instances, retry */ }
else throw e;
} Prevention
- Schedule worker-group retirement for windows with no active or scheduled workflows using the group.
- Migrate workflow schedules to a new group and drain old instances before deleting.
- Monitor for leaked non-terminal instances that permanently block deletion.
When it happens
Trigger: Calling DELETE /worker-groups/{id} while at least one workflow instance in a NOT_TERMINAL state (e.g. RUNNING_EXECUTION, WAITING) was scheduled/executed with the group's name.
Common situations: Deleting a worker group while long-running or scheduled workflows are still active; a stuck non-terminal instance blocks deletion even though nothing is really running; deleting during peak scheduler usage.
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/5a7210149197de3e.
Report an issue: GitHub.