apache/dolphinscheduler · error · ServiceException

QUEUE_VALUE_EXIST

QUEUE_VALUE_EXIST

Error message

QUEUE_VALUE_EXIST: queue value {queue} already exists

What it means

QUEUE_VALUE_EXIST is thrown by validQueue() when the queue value (the YARN queue identifier) already exists in the database. checkQueueExist(queue.getQueue()) finds a matching record, so creating would violate uniqueness. It protects the unique constraint on the queue column.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java:79

    @Autowired
    private UserDao userDao;

    @Autowired
    private TenantDao tenantDao;

    /**
     * Check the queue new object valid or not
     *
     * @param queue The queue object want to create
     */
    private void validQueue(Queue queue) throws ServiceException {
        if (StringUtils.isEmpty(queue.getQueue())) {
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE);
        } else if (StringUtils.isEmpty(queue.getQueueName())) {
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE_NAME);
        } else if (checkQueueExist(queue.getQueue())) {
            throw new ServiceException(Status.QUEUE_VALUE_EXIST, queue.getQueue());
        } else if (checkQueueNameExist(queue.getQueueName())) {
            throw new ServiceException(Status.QUEUE_NAME_EXIST, queue.getQueueName());
        }
    }

    /**
     * Check queue update object valid or not
     *
     * @param existsQueue The exists queue object
     * @param updateQueue The queue object want to update
     */
    private void updateQueueValid(Queue existsQueue, Queue updateQueue) throws ServiceException {
        // Check the exists queue and the necessary of update operation, in not exist checker have to use updateQueue to
        // avoid NPE
        if (Objects.isNull(existsQueue)) {
            throw new ServiceException(Status.QUEUE_NOT_EXIST, updateQueue.getQueue());
        } else if (Objects.equals(existsQueue, updateQueue)) {
            throw new ServiceException(Status.NEED_NOT_UPDATE_QUEUE);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Use verifyQueue first to check existence before creating
  2. Query the existing queue and reuse it instead of inserting
  3. Catch the ServiceException and treat it as idempotent success in automation scripts

Example fix

// before
queueService.createQueue(loginUser, "default", "DefaultQueue");
// after
if (queueService.verifyQueue(loginUser, "default", "DefaultQueue").isSuccess()) {
    queueService.createQueue(loginUser, "default", "DefaultQueue");
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean exists = !queueService.verifyQueue(loginUser, queue, queueName).isSuccess(); // QUEUE_VALUE_EXIST means taken
if (exists) { /* reuse existing queue */ }

Try / catch

try {
    queueService.createQueue(loginUser, queue, queueName);
} catch (ServiceException e) {
    if (e.getCode() == Status.QUEUE_VALUE_EXIST.getCode()) { /* treat as already-created */ }
    throw e;
}

Prevention

When it happens

Trigger: createQueue with a queue value already persisted; verifyQueue called with an existing queue value (expected way to probe existence); createQueueIfNotExists racing with a concurrent insert.

Common situations: Re-running an initialization script that creates queues; two admins creating the same YARN queue concurrently; migrating queue definitions from another environment without deduplication.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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