{"record":{"id":"c1bf6fbb949f6585","repo":"apache/dolphinscheduler","slug":"10010","errorCode":"10010","errorMessage":"user {userId} not exists","messagePattern":"user (.+?) not exists","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java","lineNumber":314,"sourceCode":"\n        Page<User> page = new Page<>(pageNo, pageSize);\n\n        IPage<User> scheduleList = userDao.queryUserPaging(page, searchVal);\n\n        PageInfo<User> pageInfo = new PageInfo<>(pageNo, pageSize);\n        pageInfo.setTotal((int) scheduleList.getTotal());\n        pageInfo.setTotalList(scheduleList.getRecords());\n        result.setData(pageInfo);\n        putMsg(result, Status.SUCCESS);\n\n        return result;\n    }\n\n    @Override\n    @Transactional\n    public User updateUser(User user) {\n        if (user == null || user.getId() == null) {\n            throw new ServiceException(Status.USER_NOT_EXIST);\n        }\n        // Ensure the update time is set\n        user.setUpdateTime(new Date());\n        boolean updated = userDao.updateById(user);\n\n        if (!updated) {\n            throw new ServiceException(Status.UPDATE_USER_ERROR);\n        }\n        return user;\n    }\n\n    @Override\n    @Transactional\n    public User updateUser(User loginUser,\n                           Integer userId,\n                           String userName,\n                           String userPassword,\n                           String email,","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java#L296-L332","documentation":"Thrown by UsersServiceImpl.updateUser when the User argument is null or its id is null. The method needs a primary key to run userDao.updateById; without an id there is no row to update. It signals a programming/caller bug rather than a missing database row (that case is error 334 with the userId argument).","triggerScenarios":"Calling updateUser(user) with a null User object, or with a User constructed client-side (e.g. new User()) whose id was never set; deserialization dropping the id field.","commonSituations":"API consumers building a partial update payload and forgetting to echo back the id; mapping code that copies request fields into a new User instead of fetching the existing one; JSON body missing the id key.","solutions":["Ensure the User object passed to updateUser has a non-null id (fetch it via queryByUserName first if needed)","In the REST layer, validate that the request body contains a numeric id before invoking the service","Return a 400-level param error to the caller instead of a 500 when id is absent"],"exampleFix":"// before\nUser u = new User(); u.setUserName(\"bob\");\nusersService.updateUser(u); // NPE path -> USER_NOT_EXIST\n// after\nUser u = userDao.queryByUserNameAccurately(\"bob\");\nif (u == null) throw new IllegalArgumentException(\"user 'bob' not found\");\nu.setUserName(\"bobby\");\nusersService.updateUser(u);","handlingStrategy":"validation","validationCode":"// before calling updateUser\nif (user == null || user.getId() == null) {\n    throw new IllegalArgumentException(\"updateUser requires a User with a non-null id\");\n}","typeGuard":"boolean isUpdatable(User u) { return u != null && u.getId() != null; }","tryCatchPattern":"try {\n    usersService.updateUser(user);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.USER_NOT_EXIST.getCode()) {\n        throw new BadRequestException(\"user id missing in update payload\");\n    }\n    throw e;\n}","preventionTips":["Always echo the full user object (including id) back on update requests","Fetch the entity by name/id before mutating instead of building a fresh User","Enable request-body schema validation (id required) at the API layer"],"tags":["user-management","null-check","update","dolphinscheduler"],"backgroundTag":"user-not-found","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"}