paascloud/paascloud-master · error · UacBizException

UAC10011024

UAC10011024

Error message

找不到绑定的用户, userId=%

What it means

While binding each selected user, bindUacUser4Group queries the user via uacUserService.queryByUserId(userId). If a user id does not resolve to an existing UacUser it throws UacBizException(UAC10011024) "找不到绑定的用户, userId=%" (bound user not found). Note the loop means earlier inserts already succeeded, so the transaction context matters.

Solutions

  1. Validate all userIds exist (batch query) before invoking bindUacUser4Group so nothing is half-bound.
  2. Remove stale ids from userIdList and retry; refresh the user list from the server.
  3. Catch UacBizException UAC10011024; if the service is not transactional, clean up already-inserted UacGroupUser rows before retrying.

Example fix

// before
req.setUserIdList(userIds); // may contain deleted users
uacGroupService.bindUacUser4Group(req, loginAuthDto);
// after
List<UacUser> found = uacUserService.listByUserIds(userIds);
List<Long> validIds = found.stream().map(UacUser::getId).collect(Collectors.toList());
if (validIds.size() != userIds.size()) {
    throw new BusinessException("some users no longer exist; refresh selection");
}
req.setUserIdList(validIds);
uacGroupService.bindUacUser4Group(req, loginAuthDto);
Defensive patterns

Strategy: validation

Validate before calling

Map<Long, UacUser> found = uacUserService.listByUserIds(req.getUserIdList()).stream()
    .collect(Collectors.toMap(UacUser::getId, u -> u));
List<Long> missing = req.getUserIdList().stream().filter(id -> !found.containsKey(id)).collect(Collectors.toList());
if (!missing.isEmpty()) {
    throw new BusinessException("users not found: " + missing);
}

Type guard

null

Try / catch

try {
    uacGroupService.bindUacUser4Group(req, loginAuthDto);
} catch (UacBizException e) {
    if (ErrorCodeEnum.UAC10011024.getCode().equals(e.getCode())) {
        return ResponseEntity.status(404).body("a selected user no longer exists; refresh the user list");
    }
    throw e;
}

Prevention

When it happens

Trigger: userIdList containing a stale or foreign user id — user deleted concurrently, id copied from another environment, or client sending user codes instead of numeric ids.

Common situations: Race where the user account is deleted between listing and binding; test fixtures referencing non-seeded users; environments (dev/staging) with divergent user tables.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


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

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java:329

		// 1. 先取消对该角色的用户绑定(不包含超级管理员用户)
		List<UacGroupUser> groupUsers = uacGroupUserMapper.listByGroupId(groupId);

		if (PublicUtil.isNotEmpty(groupUsers)) {
			uacGroupUserMapper.deleteExcludeSuperMng(groupId, 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);
			}
			UacGroupUser uacGroupUser = new UacGroupUser();
			uacGroupUser.setUserId(userId);
			uacGroupUser.setGroupId(groupId);
			uacGroupUserMapper.insertSelective(uacGroupUser);
		}
	}

	@Override
	public int saveUacGroup(UacGroup group, LoginAuthDto loginAuthDto) {

		int result;
		Preconditions.checkArgument(!StringUtils.isEmpty(group.getPid()), "上级节点不能为空");

		UacGroup parenGroup = uacGroupMapper.selectByPrimaryKey(group.getPid());
		if (PublicUtil.isEmpty(parenGroup)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015009, group.getPid());
		}

View on GitHub (pinned to 781281a950)