{"record":{"id":"548a2bec3e3c4828","repo":"paascloud/paascloud-master","slug":"uac10011024-548a2b","errorCode":"UAC10011024","errorMessage":"ErrorCodeEnum.UAC10011024","messagePattern":"ErrorCodeEnum\\.UAC10011024","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java","lineNumber":241,"sourceCode":"\t\t// 1. 先取消对该角色的用户绑定(不包含超级管理员用户)\n\t\tList<UacRoleUser> userRoles = uacRoleUserService.listByRoleId(roleId);\n\n\t\tif (PublicUtil.isNotEmpty(userRoles)) {\n\t\t\tuacRoleUserService.deleteExcludeSuperMng(roleId, GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID);\n\t\t}\n\n\t\tif (PublicUtil.isEmpty(userIdList)) {\n\t\t\t// 取消该角色的所有用户的绑定\n\t\t\tlogger.info(\"取消绑定所有非超级管理员用户成功\");\n\t\t\treturn;\n\t\t}\n\n\t\t// 绑定所选用户\n\t\tfor (Long userId : userIdList) {\n\t\t\tUacUser uacUser = uacUserService.queryByUserId(userId);\n\t\t\tif (PublicUtil.isEmpty(uacUser)) {\n\t\t\t\tlogger.error(\"找不到绑定的用户 userId={}\", userId);\n\t\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011024, userId);\n\t\t\t}\n\t\t\tuacRoleUserService.saveRoleUser(userId, roleId);\n\t\t}\n\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<UacRole> findAllRoleInfoByUserId(Long userId) {\n\t\treturn uacRoleMapper.selectAllRoleInfoByUserId(userId);\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic BindAuthVo getActionTreeByRoleId(Long roleId) {\n\t\tBindAuthVo bindAuthVo = new BindAuthVo();\n\t\tif (roleId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012001);","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java#L223-L259","documentation":"UacBizException UAC10011024 is thrown inside the binding loop when uacUserService.queryByUserId(userId) returns null, meaning one of the users to be bound does not exist ('找不到绑定的用户' - cannot find the user to bind). The offending userId is passed as a message argument.","triggerScenarios":"bindUser4Role called with a userIdList containing a user ID that no longer exists in uac_user (deleted between listing and binding, or from a different environment).","commonSituations":"User deleted by another admin while the role-binding page was open; stale client-side user caches; importing user lists from another database.","solutions":["Validate each userId exists (queryByUserId) before calling bindUser4Role","Refresh the selectable user list so deleted users are removed","Check that client and server point to the same environment/database"],"exampleFix":"// before\ndto.setUserIdList(ids);\nuacRoleService.bindUser4Role(dto, auth);\n// after\nfor (Long id : ids) {\n    if (uacUserService.queryByUserId(id) == null) {\n        throw new BusinessException(\"user not found: \" + id);\n    }\n}\nuacRoleService.bindUser4Role(dto, auth);","handlingStrategy":"validation","validationCode":"for (Long id : userIdList) { if (uacUserService.queryByUserId(id) == null) { throw new BusinessException(\"user not found: \" + id); } }","typeGuard":"boolean allUsersExist = userIdList.stream().allMatch(id -> uacUserService.queryByUserId(id) != null);","tryCatchPattern":"try { service.bindUser4Role(dto, auth); } catch (UacBizException e) { if (\"UAC10011024\".equals(e.getCode())) { return Response.badRequest(\"one of the users no longer exists\"); } throw e; }","preventionTips":["Validate all user IDs immediately before binding","Refresh user lists after deletions"],"tags":["entity-not-found","java","user"],"backgroundTag":"entity-not-found","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}