apache/dolphinscheduler · error · ServiceException

130020

130020

Error message

Not allow to disable your own account

What it means

Thrown by UsersServiceImpl.updateUser when an admin attempts to set state=0 (disabled) on their own account. The guard compares loginUser.getId() with the target user's id and rejects self-disabling with NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT (code 130020), because it would lock the operator out of the system.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java:391

                throw new ServiceException(Status.USER_PASSWORD_LENGTH_ERROR);
            }
            user.setUserPassword(EncryptionUtils.getMd5(userPassword));
            sessionService.expireSession(user.getId());
        }

        if (StringUtils.isNotEmpty(email)) {
            if (!CheckUtils.checkEmail(email)) {
                throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, email);
            }
            user.setEmail(email);
        }

        if (StringUtils.isNotEmpty(phone) && !CheckUtils.checkPhone(phone)) {
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, phone);
        }

        if (state == 0 && user.getState() != state && Objects.equals(loginUser.getId(), user.getId())) {
            throw new ServiceException(Status.NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT);
        }

        if (StringUtils.isNotEmpty(timeZone)) {
            if (!CheckUtils.checkTimeZone(timeZone)) {
                throw new ServiceException(Status.TIME_ZONE_ILLEGAL, timeZone);
            }
            user.setTimeZone(timeZone);
        }

        user.setPhone(phone);
        user.setQueue(queue);
        user.setState(state);
        user.setUpdateTime(new Date());
        user.setTenantId(tenantId);
        // updateWorkflowInstance user
        if (!userDao.updateById(user)) {
            throw new ServiceException(Status.UPDATE_USER_ERROR);
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Disable the account using a different admin account
  2. Keep state=1 when updating your own user record
  3. Exclude the currently logged-in user id from bulk-disable lists

Example fix

// before
if (targetUser.getId() == loginUser.getId()) { state = 0; } // fails
// after
if (targetUser.getId() != loginUser.getId()) { state = 0; } // disable others only
Defensive patterns

Strategy: validation

Validate before calling

if (state == 0 && targetUserId == loginUser.getId()) {
    throw new IllegalStateException("cannot disable your own account");
}

Try / catch

try { userService.updateUser(...); } catch (ServiceException e) { if (e.getCode() == 130020) { notify("Use another admin to disable this account"); } }

Prevention

When it happens

Trigger: Admin calls users/update with state=0 where the target user id equals the logged-in admin's own id and the account is currently enabled (state 1).

Common situations: Admin editing their own profile via the UI and toggling themselves to disabled; bulk scripts disabling users that include the admin account itself.

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/1318a1309ef1e707. Report an issue: GitHub.