paascloud/paascloud-master · error · UacBizException

UAC10015008

UAC10015008

Error message

该组织下绑定的用户,不能将其删除, groupId=%s

What it means

UAC10015008 ("该组织下绑定的用户,不能将其删除, groupId=%s") is thrown by deleteUacGroupById when users are still bound to the group (rows in uac_group_user with groupId = id). The delete is blocked to avoid breaking user-group memberships.

Solutions

  1. Unbind all users from the group first (delete uac_group_user rows or call the unbind-user API), then delete the group
  2. Reassign users to another group before deleting the old one
  3. Catch UacBizException UAC10015008 and show the affected user count in the UI before forcing unbind

Example fix

// before
uacGroupService.deleteUacGroupById(groupId);
// after
List<UacGroupUser> bindings = uacGroupUserService.listByGroupId(groupId);
for (UacGroupUser bu : bindings) {
    uacGroupUserService.delete(bu); // unbind users first
}
uacGroupService.deleteUacGroupById(groupId);
Defensive patterns

Strategy: validation

Validate before calling

List<UacGroupUser> bindings = uacGroupUserMapper.select(new UacGroupUser().setGroupId(groupId));
if (!bindings.isEmpty()) { throw new IllegalStateException("Unbind " + bindings.size() + " users first"); }

Try / catch

try {
    uacGroupService.deleteUacGroupById(groupId);
} catch (UacBizException e) {
    if (ErrorCodeEnum.UAC10015008.getCode().equals(e.getCode())) { /* offer to unbind/reassign users, then retry */ }
    else throw e;
}

Prevention

When it happens

Trigger: Calling deleteUacGroupById(id) where uacGroupUserMapper.select(uacGroupUser with groupId=id) returns a non-empty user binding list.

Common situations: Retiring a department that still has members; users were auto-assigned to the group by onboarding flows; bindings left behind after users were nominally transferred but group_user rows not cleaned.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

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

		// 根据前台传入的组织参数校验该组织是否存在
		UacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(id);
		if (PublicUtil.isEmpty(uacGroup)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015004, id);
		}
		//判断该组织下是否存在子节点
		UacGroup childGroup = new UacGroup();
		childGroup.setPid(id);
		List<UacGroup> childGroupList = uacGroupMapper.select(childGroup);
		if (PublicUtil.isNotEmpty(childGroupList)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015007, id);
		}
		//判断该组织下是否存在用户
		UacGroupUser uacGroupUser = new UacGroupUser();
		uacGroupUser.setGroupId(id);
		List<UacGroupUser> uacGroupUserList = uacGroupUserMapper.select(uacGroupUser);
		if (PublicUtil.isNotEmpty(uacGroupUserList)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015008, id);
		}

		return mapper.deleteByPrimaryKey(id);
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public UacGroup queryById(Long groupId) {
		Preconditions.checkArgument(PublicUtil.isNotEmpty(groupId), "组织Id不能为空");
		UacGroup query = new UacGroup();
		query.setId(groupId);
		return uacGroupMapper.selectOne(query);
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<GroupZtreeVo> getGroupTree(Long groupId) {
		// 1. 如果是仓库则 直接把仓库信息封装成ztreeVo返回

View on GitHub (pinned to 781281a950)