{"record":{"id":"51ea1dcab83d79dd","repo":"apache/dolphinscheduler","slug":"1300017","errorCode":"1300017","errorMessage":"user's password length error","messagePattern":"user's password length error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java","lineNumber":373,"sourceCode":"        }\n\n        if (StringUtils.isNotEmpty(userName)) {\n\n            if (!CheckUtils.checkUserName(userName)) {\n                throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName);\n            }\n\n            // todo: use the db unique index\n            User tempUser = userDao.queryByUserNameAccurately(userName);\n            if (tempUser != null && !userId.equals(tempUser.getId())) {\n                throw new ServiceException(Status.USER_NAME_EXIST);\n            }\n            user.setUserName(userName);\n        }\n\n        if (StringUtils.isNotEmpty(userPassword)) {\n            if (!CheckUtils.checkPasswordLength(userPassword)) {\n                throw new ServiceException(Status.USER_PASSWORD_LENGTH_ERROR);\n            }\n            user.setUserPassword(EncryptionUtils.getMd5(userPassword));\n            sessionService.expireSession(user.getId());\n        }\n\n        if (StringUtils.isNotEmpty(email)) {\n            if (!CheckUtils.checkEmail(email)) {\n                throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, email);\n            }\n            user.setEmail(email);\n        }\n\n        if (StringUtils.isNotEmpty(phone) && !CheckUtils.checkPhone(phone)) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, phone);\n        }\n\n        if (state == 0 && user.getState() != state && Objects.equals(loginUser.getId(), user.getId())) {\n            throw new ServiceException(Status.NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT);","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java#L355-L391","documentation":"Thrown by UsersServiceImpl.updateUser when a new userPassword is supplied but CheckUtils.checkPasswordLength fails, i.e. the password length is outside the policy (too short, or beyond the maximum that can be stored). The password is never hashed/updated in that case; session expiry for the user also does not run.","triggerScenarios":"PUT /users with a password shorter than the minimum (per default policy, out of the 2..~40 range enforced by checkPasswordLength); scripts setting empty or 1-char passwords; password manager output exceeding the max length.","commonSituations":"Automated provisioning generating weak default passwords; UI allowing unlimited input but backend rejecting; policy changes across DolphinScheduler versions making previously valid passwords too short.","solutions":["Generate a password within the enforced length bounds (use a strong value well above the minimum)","Check CheckUtils.checkPasswordLength in your version for the exact min/max","Add client-side length validation before calling the API","Update provisioning templates that set short bootstrap passwords"],"exampleFix":"// before\nString pwd = \"ab\"; // too short\nusersService.updateUser(loginUser, userId, null, pwd, ...);\n// after\nString pwd = PasswordGenerator.random(12); // within policy\nif (pwd.length() < 6 || pwd.length() > 40) throw new IllegalArgumentException(\"password length invalid\");\nusersService.updateUser(loginUser, userId, null, pwd, ...);","handlingStrategy":"validation","validationCode":"// mirror CheckUtils.checkPasswordLength before calling\nif (userPassword != null && (userPassword.length() < 6 || userPassword.length() > 40)) {\n    throw new IllegalArgumentException(\"password length must be within policy\");\n}","typeGuard":"boolean isValidPassword(String pwd) {\n    return pwd != null && pwd.length() >= 6 && pwd.length() <= 40; // align with checkPasswordLength\n}","tryCatchPattern":"try {\n    usersService.updateUser(loginUser, userId, name, userPassword, ...);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.USER_PASSWORD_LENGTH_ERROR.getCode()) {\n        // regenerate a compliant password and retry\n    } else { throw e; }\n}","preventionTips":["Generate passwords of 8-32 chars to stay within typical bounds","Validate password length in the UI and in provisioning scripts","Re-check policy after upgrading DolphinScheduler versions"],"tags":["password","validation","user-management","dolphinscheduler"],"backgroundTag":"value-out-of-range","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"}