paascloud/paascloud-master · error · UacBizException
UAC10011003
UAC10011003
Error message
ErrorCodeEnum.UAC10011003
What it means
UacBizException with ErrorCodeEnum.UAC10011003 ("找不到用户,userId=%s") is thrown by UacUserServiceImpl.bindUserRoles when this.queryByUserId(operUserId) returns null — the target user for role binding does not exist in uac_user.
Solutions
- Verify the user exists via the user-detail API before binding roles
- Refresh user lists after deletions so the client never submits a stale userId
- Catch UacBizException code 10011003 and report 'target user no longer exists'
- Check soft-delete state of the user row if you believe the id is valid
Example fix
// before
BindUserRolesDto dto = new BindUserRolesDto();
dto.setUserId(request.getUserId());
uacUserService.bindUserRoles(dto, authResDto);
// after
UacUser target = uacUserService.queryByUserId(request.getUserId());
if (target != null) {
BindUserRolesDto dto = new BindUserRolesDto();
dto.setUserId(request.getUserId());
uacUserService.bindUserRoles(dto, authResDto);
} Defensive patterns
Strategy: validation
Validate before calling
UacUser target = uacUserService.queryByUserId(dto.getUserId());
if (target == null) {
throw new BusinessException("target user not found");
} Try / catch
try {
uacUserService.bindUserRoles(dto, authResDto);
} catch (UacBizException e) {
if (e.getCode() == 10011003) { /* report user no longer exists */ }
else throw e;
} Prevention
- Verify user existence before role operations
- Refresh user lists after deletes
- Avoid hard-coded ids across environments
When it happens
Trigger: Calling bindUserRoles with a DTO whose userId references a deleted/nonexistent user, or an id from a different database/environment.
Common situations: Stale user list in the UI after concurrent deletion; script or test fixture with hard-coded ids; ids copied between dev/prod environments; soft-deleted users invisible to queryByUserId.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/b9dde9ab5d9875ea.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:302
Long operUserId = bindUserRolesDto.getUserId();
Long loginUserId = authResDto.getUserId();
List<Long> roleIdList = bindUserRolesDto.getRoleIdList();
if (null == operUserId) {
throw new UacBizException(ErrorCodeEnum.UAC10011001);
}
// 任何用户不能操作admin用户
if (Objects.equals(operUserId, GlobalConstant.Sys.SUPER_MANAGER_USER_ID)) {
throw new UacBizException(ErrorCodeEnum.UAC10011034);
}
UacUser user = this.queryByUserId(operUserId);
if (user == null) {
logger.error("找不到用户信息 operUserId={}", operUserId);
throw new UacBizException(ErrorCodeEnum.UAC10011003, operUserId);
}
if (PublicUtil.isNotEmpty(roleIdList) && roleIdList.contains(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID)) {
logger.error("操作超级管理员角色 userId={}", loginUserId);
throw new UacBizException(ErrorCodeEnum.UAC10011023);
}
// 1. 先取消对该角色的用户绑定(不包含超级管理员用户)
List<UacRoleUser> userRoles = uacRoleUserService.listByUserId(operUserId);
if (PublicUtil.isNotEmpty(userRoles)) {
uacRoleUserService.deleteByUserId(operUserId);
}
// 更新用户的操作时间
final UacUser updateUser = new UacUser();
updateUser.setId(operUserId);
updateUser.setUpdateInfo(authResDto);View on GitHub (pinned to 781281a950)