{"record":{"id":"bd6c94015b2c20b5","repo":"apache/dolphinscheduler","slug":"queue-value-exist","errorCode":"QUEUE_VALUE_EXIST","errorMessage":"QUEUE_VALUE_EXIST: queue value {queue} already exists","messagePattern":"QUEUE_VALUE_EXIST: queue value (.+?) already exists","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java","lineNumber":79,"sourceCode":"\n    @Autowired\n    private UserDao userDao;\n\n    @Autowired\n    private TenantDao tenantDao;\n\n    /**\n     * Check the queue new object valid or not\n     *\n     * @param queue The queue object want to create\n     */\n    private void validQueue(Queue queue) throws ServiceException {\n        if (StringUtils.isEmpty(queue.getQueue())) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE);\n        } else if (StringUtils.isEmpty(queue.getQueueName())) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE_NAME);\n        } else if (checkQueueExist(queue.getQueue())) {\n            throw new ServiceException(Status.QUEUE_VALUE_EXIST, queue.getQueue());\n        } else if (checkQueueNameExist(queue.getQueueName())) {\n            throw new ServiceException(Status.QUEUE_NAME_EXIST, queue.getQueueName());\n        }\n    }\n\n    /**\n     * Check queue update object valid or not\n     *\n     * @param existsQueue The exists queue object\n     * @param updateQueue The queue object want to update\n     */\n    private void updateQueueValid(Queue existsQueue, Queue updateQueue) throws ServiceException {\n        // Check the exists queue and the necessary of update operation, in not exist checker have to use updateQueue to\n        // avoid NPE\n        if (Objects.isNull(existsQueue)) {\n            throw new ServiceException(Status.QUEUE_NOT_EXIST, updateQueue.getQueue());\n        } else if (Objects.equals(existsQueue, updateQueue)) {\n            throw new ServiceException(Status.NEED_NOT_UPDATE_QUEUE);","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"Re-running an initialization script that creates queues; two admins creating the same YARN queue concurrently; migrating queue definitions from another environment without deduplication.","solutions":["Use verifyQueue first to check existence before creating","Query the existing queue and reuse it instead of inserting","Catch the ServiceException and treat it as idempotent success in automation scripts"],"exampleFix":"// before\nqueueService.createQueue(loginUser, \"default\", \"DefaultQueue\");\n// after\nif (queueService.verifyQueue(loginUser, \"default\", \"DefaultQueue\").isSuccess()) {\n    queueService.createQueue(loginUser, \"default\", \"DefaultQueue\");\n}","handlingStrategy":"try-catch","validationCode":"boolean exists = !queueService.verifyQueue(loginUser, queue, queueName).isSuccess(); // QUEUE_VALUE_EXIST means taken\nif (exists) { /* reuse existing queue */ }","typeGuard":null,"tryCatchPattern":"try {\n    queueService.createQueue(loginUser, queue, queueName);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.QUEUE_VALUE_EXIST.getCode()) { /* treat as already-created */ }\n    throw e;\n}","preventionTips":["Check existence with verifyQueue before insert","Make creation scripts idempotent","Deduplicate seed data before import"],"tags":["duplicate","queue","conflict"],"backgroundTag":"file-already-exists","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}