{"record":{"id":"d713dd17df86054a","repo":"apache/dolphinscheduler","slug":"130019","errorCode":"130019","errorMessage":"The task group has been opened.","messagePattern":"The task group has been opened\\.","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":233,"sourceCode":"        }\n        taskGroup.setStatus(Flag.NO);\n        if (taskGroupMapper.updateById(taskGroup) > 0) {\n            log.info(\"Task group close complete, taskGroupId:{}.\", id);\n        } else {\n            log.error(\"Task group close error, taskGroupId:{}.\", id);\n        }\n    }\n\n    @Override\n    public void startTaskGroup(User loginUser, int id) {\n        if (!canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP,\n                ApiFuncIdentificationConstant.TASK_GROUP_CLOSE)) {\n            throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);\n        }\n        TaskGroup taskGroup = taskGroupMapper.selectById(id);\n        if (taskGroup.getStatus() == Flag.YES) {\n            log.info(\"Task group has been started, taskGroupId:{}.\", id);\n            throw new ServiceException(Status.TASK_GROUP_STATUS_OPENED);\n        }\n        taskGroup.setStatus(Flag.YES);\n        taskGroup.setUpdateTime(new Date(System.currentTimeMillis()));\n        if (taskGroupMapper.updateById(taskGroup) > 0) {\n            log.info(\"Task group start complete, taskGroupId:{}.\", id);\n        } else {\n            log.error(\"Task group start error, taskGroupId:{}.\", id);\n        }\n    }\n\n    @Override\n    public void forceStartTask(User loginUser, int queueId) {\n        if (!canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP,\n                ApiFuncIdentificationConstant.TASK_GROUP_QUEUE_START)) {\n            throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);\n        }\n        executorService.forceStartTaskInstance(loginUser, queueId);\n    }","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L215-L251","documentation":"Thrown by startTaskGroup when the task group's status is already Flag.YES, i.e. it is already open/started. Starting an already-open group is rejected with Status.TASK_GROUP_STATUS_OPENED (code 130019).","triggerScenarios":"Calling POST /task-group/start on a group that is already enabled; retrying a start request that already succeeded; concurrent start calls from multiple clients.","commonSituations":"Double-submitted forms; scheduled scripts that re-run a start step; stale UI showing the group as closed when it is open.","solutions":["Query the group status first (GET /task-group/list-paging) and skip if already open.","Treat code 130019 as success in idempotent retry paths.","Refresh UI state before retrying.","If it must be closed, call /task-group/close first."],"exampleFix":"// before\ntaskGroupService.startTaskGroup(loginUser, id);\n// after\ntry {\n    taskGroupService.startTaskGroup(loginUser, id);\n} catch (ServiceException e) {\n    if (e.getCode() != 130019) throw e; // already open is acceptable\n}","handlingStrategy":"validation","validationCode":"// Java: check status before starting\nTaskGroup tg = taskGroupMapper.selectById(id);\nif (tg != null && tg.getStatus() == Flag.YES) {\n    return; // already open\n}","typeGuard":"boolean isOpened(TaskGroup tg) {\n    return tg != null && tg.getStatus() == Flag.YES;\n}","tryCatchPattern":"try {\n    taskGroupService.startTaskGroup(loginUser, id);\n} catch (ServiceException e) {\n    if (e.getCode() == 130019) {\n        log.info(\"Task group {} already open; treating as success\", id);\n        return;\n    }\n    throw e;\n}","preventionTips":["Fetch current status before any start call.","Treat 'already opened' (130019) as success in idempotent retry paths.","Guard against double submission in UIs and schedulers.","Refresh cached task group state after failures."],"tags":["task-group","idempotency","invalid-state"],"backgroundTag":"invalid-state-transition","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"}