apache/dolphinscheduler · error · ServiceException
DELETE_QUEUE_BY_ID_FAIL_USERS
DELETE_QUEUE_BY_ID_FAIL_USERS
Error message
DELETE_QUEUE_BY_ID_FAIL_USERS: {userCount} users are using this queue, delete failed What it means
QueueServiceImpl.deleteQueueById throws ServiceException(Status.DELETE_QUEUE_BY_ID_FAIL_USERS, userCount) when users still reference the queue by name: userDao.queryUserListByQueue(queue.getQueueName()) returns a non-empty list. This is a second referential-integrity guard, after the tenant check; queues referenced by user records cannot be deleted. The message interpolates the number of blocking users.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java:238
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
Queue queue = queueDao.queryById(id);
if (Objects.isNull(queue)) {
log.error("Queue does not exist");
throw new ServiceException(Status.QUEUE_NOT_EXIST);
}
List<Tenant> tenantList = tenantDao.queryTenantListByQueueId(queue.getId());
if (CollectionUtils.isNotEmpty(tenantList)) {
log.warn("Delete queue failed, because there are {} tenants using it.", tenantList.size());
throw new ServiceException(Status.DELETE_TENANT_BY_ID_FAIL_TENANTS, tenantList.size());
}
List<User> userList = userDao.queryUserListByQueue(queue.getQueueName());
if (CollectionUtils.isNotEmpty(userList)) {
log.warn("Delete queue failed, because there are {} users using it.", userList.size());
throw new ServiceException(Status.DELETE_QUEUE_BY_ID_FAIL_USERS, userList.size());
}
if (!queueDao.deleteById(id)) {
throw new ServiceException(Status.DELETE_QUEUE_BY_ID_ERROR);
}
}
/**
* verify queue and queueName
*
* @param queue queue
* @param queueName queue name
* @return true if the queue name not exists, otherwise return false
*/
@Override
public void verifyQueue(String queue, String queueName) {
Queue queueValidator = new Queue(queueName, queue);View on GitHub (pinned to 02eac45a1b)
Solutions
- Update each blocking user's queue to another queue (user management API/UI), then retry the delete.
- Find the users via the reported count: query t_ds_user WHERE queue = '<queueName>' and reassign them.
- If the user-level queue field is unused in your deployment, clear it (set to default) for those users, then delete the queue.
Example fix
// before deleteQueueById(loginUser, 7) -> DELETE_QUEUE_BY_ID_FAIL_USERS (2 users) // after: reassign users first userService.updateUser(loginUser, userId, ..., "default"); // for each blocking user deleteQueueById(loginUser, 7) -> succeeds
Defensive patterns
Strategy: validation
Validate before calling
// check user references before deleting
List<User> users = userDao.queryUserListByQueue(queueName);
if (!users.isEmpty()) {
throw new IllegalStateException("Queue " + queueName + " still used by " + users.size() + " user(s)");
} Try / catch
try {
queueService.deleteQueueById(loginUser, id);
} catch (ServiceException e) {
if (Status.DELETE_QUEUE_BY_ID_FAIL_USERS.getCode() == e.getCode()) {
// reassign users then retry
} else { throw e; }
} Prevention
- Migrate both tenants AND users off a queue before delete
- Sweep legacy t_ds_user.queue values during cleanups
- Run a pre-delete dependency report
When it happens
Trigger: Deleting a queue while rows in t_ds_user have queue equal to the queue's queueName; legacy user records still carrying the queue name after tenants were migrated off it.
Common situations: After reassigning tenants but forgetting that individual users also carry a queue field; old user profiles pointing at a decommissioned YARN queue; data migrated from older DolphinScheduler versions keeping the user.queue column populated.
Related errors
- DELETE_TENANT_BY_ID_FAIL_TENANTS
- 110012
- 120034
- DELETE_ENVIRONMENT_RELATED_TASK_EXISTS
- DELETE_QUEUE_BY_ID_ERROR
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/502ef2bef39cce3d.
Report an issue: GitHub.