paascloud/paascloud-master · warning · UacBizException

UAC10011001

UAC10011001

Error message

ErrorCodeEnum.UAC10011001

What it means

UacBizException with ErrorCodeEnum.UAC10011001 ("用户Id不能为空") is thrown by UacUserServiceImpl.queryUserLogListWithUserId when the userId argument is null or empty. The user id is mandatory to look up audit logs, so a null id is rejected before querying.

Solutions

  1. Ensure the caller always passes a non-null userId; validate in the controller with @NotNull before invoking the service
  2. Check request binding: the endpoint must include userId as a path variable or query param
  3. Guard the calling code: skip the log lookup when the user object hasn't been loaded yet

Example fix

// before
List<UacLog> logs = uacUserService.queryUserLogListWithUserId(userDto.getId());
// after
if (userDto == null || userDto.getId() == null) {
    throw new IllegalArgumentException("userId is required");
}
List<UacLog> logs = uacUserService.queryUserLogListWithUserId(userDto.getId());
Defensive patterns

Strategy: validation

Validate before calling

if (userId == null) {
    throw new IllegalArgumentException("userId is required");
}

Type guard

if (userId != null && userId > 0) {
    List<UacLog> logs = uacUserService.queryUserLogListWithUserId(userId);
}

Try / catch

try {
    return uacUserService.queryUserLogListWithUserId(userId);
} catch (UacBizException e) {
    if (e.getCode() == 10011001) { return Collections.emptyList(); }
    throw e;
}

Prevention

When it happens

Trigger: Calling queryUserLogListWithUserId(null), or passing a DTO/path variable that failed to bind (missing userId parameter in the controller request).

Common situations: Frontend omits userId in the query string; a profile/audit page renders before the user object is loaded; deserialization of a JSON body without the id field yields a null Long.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:254

				groupUser.setGroupId(user.getGroupId());
				groupUser.setUserId(user.getId());
				uacGroupUserService.save(groupUser);
			} else {
				//修改组织
				UacGroupUser groupUser = new UacGroupUser();
				groupUser.setUserId(user.getId());
				groupUser.setGroupId(user.getGroupId());
				uacGroupUserService.updateByUserId(groupUser);
			}
		}

	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<UacLog> queryUserLogListWithUserId(Long userId) {
		if (PublicUtil.isEmpty(userId)) {
			throw new UacBizException(ErrorCodeEnum.UAC10011001);
		}
		return uacLogService.selectUserLogListByUserId(userId);
	}

	@Override
	public int modifyUserStatusById(UacUser uacUser, LoginAuthDto authResDto) {
		Long loginUserId = authResDto.getUserId();
		Long userId = uacUser.getId();
		if (loginUserId.equals(userId)) {
			throw new UacBizException(ErrorCodeEnum.UAC10011023);
		}
		UacUser u = uacUserMapper.selectByPrimaryKey(userId);
		if (u == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10011011, userId);
		}

		// 更新用户最后修改人与修改时间
		uacUser.setVersion(u.getVersion() + 1);

View on GitHub (pinned to 781281a950)