apache/dolphinscheduler · error · ServiceException

10142

10142

Error message

delete tenant by id fail, for there are {count} workflow instances in executing using it

What it means

Thrown in TenantServiceImpl.deleteTenantById when running workflow instances still reference the tenant ({count} instances). Deleting a tenant in use by executing workflows would break those instances, so the delete is blocked until they finish or are stopped.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java:230

     * @return delete result code
     * @throws Exception exception
     */
    @Override
    @Transactional()
    public void deleteTenantById(User loginUser, int id) throws Exception {

        if (!canOperatorPermissions(loginUser, null, AuthorizationType.TENANT, TENANT_DELETE)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }

        Tenant tenant = tenantDao.queryDetailById(id);
        if (Objects.isNull(tenant)) {
            throw new ServiceException(Status.TENANT_NOT_EXIST);
        }

        List<WorkflowInstanceSummaryDto> workflowInstances = getWorkflowInstancesByTenant(tenant);
        if (CollectionUtils.isNotEmpty(workflowInstances)) {
            throw new ServiceException(Status.DELETE_TENANT_BY_ID_FAIL, workflowInstances.size());
        }

        List<Schedule> schedules = scheduleDao.queryScheduleListByTenant(tenant.getTenantCode());
        if (CollectionUtils.isNotEmpty(schedules)) {
            throw new ServiceException(Status.DELETE_TENANT_BY_ID_FAIL_DEFINES, schedules.size());
        }

        List<User> userList = userDao.queryUserListByTenant(tenant.getId());
        if (CollectionUtils.isNotEmpty(userList)) {
            throw new ServiceException(Status.DELETE_TENANT_BY_ID_FAIL_USERS, userList.size());
        }

        if (!tenantDao.deleteById(id)) {
            throw new ServiceException(Status.DELETE_TENANT_BY_ID_ERROR);
        }

        workflowInstanceDao.updateWorkflowInstanceByTenantCode(tenant.getTenantCode(), Constants.DEFAULT);
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Wait for the running workflow instances to complete, or stop/kill them, then retry the delete.
  2. Reassign those workflow instances to another tenant.
  3. Check the workflow instance list filtered by this tenant to find the blocking instances.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java:230 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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