paascloud/paascloud-master · error · UacBizException

UAC10011024

UAC10011024

Error message

ErrorCodeEnum.UAC10011024

What it means

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.

Solutions

  1. Validate each userId exists (queryByUserId) before calling bindUser4Role
  2. Refresh the selectable user list so deleted users are removed
  3. Check that client and server point to the same environment/database

Example fix

// before
dto.setUserIdList(ids);
uacRoleService.bindUser4Role(dto, auth);
// after
for (Long id : ids) {
    if (uacUserService.queryByUserId(id) == null) {
        throw new BusinessException("user not found: " + id);
    }
}
uacRoleService.bindUser4Role(dto, auth);
Defensive patterns

Strategy: validation

Validate before calling

for (Long id : userIdList) { if (uacUserService.queryByUserId(id) == null) { throw new BusinessException("user not found: " + id); } }

Type guard

boolean allUsersExist = userIdList.stream().allMatch(id -> uacUserService.queryByUserId(id) != null);

Try / catch

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; }

Prevention

When it happens

Trigger: 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).

Common situations: User deleted by another admin while the role-binding page was open; stale client-side user caches; importing user lists from another database.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/548a2bec3e3c4828. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java:241

		// 1. 先取消对该角色的用户绑定(不包含超级管理员用户)
		List<UacRoleUser> userRoles = uacRoleUserService.listByRoleId(roleId);

		if (PublicUtil.isNotEmpty(userRoles)) {
			uacRoleUserService.deleteExcludeSuperMng(roleId, GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID);
		}

		if (PublicUtil.isEmpty(userIdList)) {
			// 取消该角色的所有用户的绑定
			logger.info("取消绑定所有非超级管理员用户成功");
			return;
		}

		// 绑定所选用户
		for (Long userId : userIdList) {
			UacUser uacUser = uacUserService.queryByUserId(userId);
			if (PublicUtil.isEmpty(uacUser)) {
				logger.error("找不到绑定的用户 userId={}", userId);
				throw new UacBizException(ErrorCodeEnum.UAC10011024, userId);
			}
			uacRoleUserService.saveRoleUser(userId, roleId);
		}

	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<UacRole> findAllRoleInfoByUserId(Long userId) {
		return uacRoleMapper.selectAllRoleInfoByUserId(userId);
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public BindAuthVo getActionTreeByRoleId(Long roleId) {
		BindAuthVo bindAuthVo = new BindAuthVo();
		if (roleId == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10012001);

View on GitHub (pinned to 781281a950)