apache/dolphinscheduler · warning · ServiceException
130018
130018
Error message
The task group has been closed.
What it means
Thrown by closeTaskGroup when the target task group's status is already Flag.NO, i.e. it is already closed. This is an idempotency/state guard: closing an already-closed group is rejected with Status.TASK_GROUP_STATUS_CLOSED (code 130018).
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java:214
public PageInfo<TaskGroup> doQuery(User loginUser, int pageNo, int pageSize, int userId, String name,
Integer status) {
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
IPage<TaskGroup> taskGroupPaging =
taskGroupMapper.queryTaskGroupPaging(page, name, status);
return buildPageInfo(pageNo, pageSize, taskGroupPaging);
}
@Override
public void closeTaskGroup(User loginUser, int id) {
if (!canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP,
ApiFuncIdentificationConstant.TASK_GROUP_CLOSE)) {
throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.NO) {
log.info("Task group has been closed, taskGroupId:{}.", id);
throw new ServiceException(Status.TASK_GROUP_STATUS_CLOSED);
}
taskGroup.setStatus(Flag.NO);
if (taskGroupMapper.updateById(taskGroup) > 0) {
log.info("Task group close complete, taskGroupId:{}.", id);
} else {
log.error("Task group close error, taskGroupId:{}.", id);
}
}
@Override
public void startTaskGroup(User loginUser, int id) {
if (!canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP,
ApiFuncIdentificationConstant.TASK_GROUP_CLOSE)) {
throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.YES) {
log.info("Task group has been started, taskGroupId:{}.", id);View on GitHub (pinned to 02eac45a1b)
Solutions
- Check the group status first via GET /task-group/list-paging and skip closing if already closed.
- Treat code 130018 as success in idempotent retry logic (the desired end state is already reached).
- Refresh the task group list in the UI before retrying.
- If the group must be open, call /task-group/start first.
Example fix
// before
try {
taskGroupService.closeTaskGroup(loginUser, id);
} catch (ServiceException e) { /* retries blindly */ }
// after
try {
taskGroupService.closeTaskGroup(loginUser, id);
} catch (ServiceException e) {
if (e.getCode() != 130018) throw e; // already closed is acceptable
} Defensive patterns
Strategy: validation
Validate before calling
// Java: check status before closing
TaskGroup tg = taskGroupMapper.selectById(id);
if (tg != null && tg.getStatus() == Flag.NO) {
return; // already closed, nothing to do
} Type guard
boolean isClosed(TaskGroup tg) {
return tg != null && tg.getStatus() == Flag.NO;
} Try / catch
try {
taskGroupService.closeTaskGroup(loginUser, id);
} catch (ServiceException e) {
if (e.getCode() == 130018) {
log.info("Task group {} already closed; treating as success", id);
return;
}
throw e;
} Prevention
- Fetch current status before any close call.
- Treat 'already closed' (130018) as success in retry/idempotent paths.
- Debounce/double-submit protection on the close button in UIs.
- Reconcile UI state with the DB after any failed request.
When it happens
Trigger: Calling POST /task-group/close twice on the same task group id; retrying a close request after a first attempt already succeeded; concurrent close calls from two clients.
Common situations: Double-clicked UI button; automated scripts re-running a close step after a timeout though the first call went through; UI state out of sync with the DB.
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/b12f44bb31d9e3b7.
Report an issue: GitHub.