{"record":{"id":"d2961f984cb67337","repo":"apache/dolphinscheduler","slug":"10092","errorCode":"10092","errorMessage":"update user error","messagePattern":"update user 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":321,"sourceCode":"        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,\n                           Integer tenantId,\n                           String phone,\n                           String queue,\n                           int state,\n                           String timeZone) {\n\n        if (!canOperator(loginUser, userId)) {","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java#L303-L339","documentation":"Thrown by UsersServiceImpl.updateUser when userDao.updateById returns false, i.e. the MyBatis-Plus UPDATE statement affected zero rows. Since the null/id checks already passed, the usual cause is a race where the row was deleted concurrently, or a DB-level failure surfaced as a no-op. The @Transactional boundary rolls back any partial work.","triggerScenarios":"Another admin deleted the user between the queryById and updateById calls; updateById invoked with an id that no longer exists in t_ds_user; database connectivity/lock issues causing the update to fail silently.","commonSituations":"Concurrent admin operations on the same user record; stale UI session editing a user that was just removed; replication lag or DB outages in clustered deployments.","solutions":["Re-fetch the user (userDao.queryById) to confirm it still exists, then retry the update once","Wrap the delete-vs-update race: catch this error and report 'user was concurrently modified/deleted'","Check database logs/health if updates fail systematically","Retry the whole read-modify-write flow rather than only the update"],"exampleFix":"// before\nUser user = userDao.queryById(userId);\nuser.setUserName(\"newName\");\nusersService.updateUser(user); // may throw UPDATE_USER_ERROR if deleted meanwhile\n// after\nUser user = userDao.queryById(userId);\nif (user == null) throw new ServiceException(Status.USER_NOT_EXIST, userId);\nuser.setUserName(\"newName\");\ntry {\n    usersService.updateUser(user);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.UPDATE_USER_ERROR.getCode()) {\n        // user deleted concurrently; surface as not-found\n        throw new ServiceException(Status.USER_NOT_EXIST, userId);\n    }\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"User current = userDao.queryById(user.getId());\nif (current == null) {\n    throw new ServiceException(Status.USER_NOT_EXIST, user.getId()); // avoid zero-row update\n}","typeGuard":null,"tryCatchPattern":"try {\n    usersService.updateUser(user);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.UPDATE_USER_ERROR.getCode()) {\n        // re-read user; if gone, surface NOT_FOUND; else retry once\n    } else { throw e; }\n}","preventionTips":["Re-fetch the row inside the same transaction before updating","Keep user-deletion and user-edit flows serialized (locking or optimistic version column)","Monitor DB health if update failures cluster in time"],"tags":["database","update","concurrency","dolphinscheduler"],"backgroundTag":"database-write-failed","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"}