paascloud/paascloud-master · error · UacBizException

UAC10011002

UAC10011002

Error message

找不到用户,loginName=%s

What it means

loginAfter performs post-login processing: it resolves the user by loginName via uacUserService.findByLoginName. If no user matches it throws UacBizException(UAC10011002) "找不到用户,loginName=%s". This usually means the session carried a loginName that no longer maps to an existing account.

Solutions

  1. Verify the loginName exists (findByLoginName) before invoking loginAfter; invalidate the session if not.
  2. Clear stale session/Redis token data after database resets or user deletions so dead loginNames aren't replayed.
  3. Catch UacBizException UAC10011002, force logout, and redirect the user to re-authenticate.

Example fix

// before
uacLoginService.loginAfter(request, loginName); // stale session name
// after
UacUser user = uacUserService.findByLoginName(loginName);
if (user == null) {
    sessionService.invalidate(sessionId);
    throw new AuthException("session references deleted user; please re-login");
}
uacLoginService.loginAfter(request, loginName);
Defensive patterns

Strategy: try-catch

Validate before calling

UacUser user = uacUserService.findByLoginName(loginName);
if (user == null) {
    // invalidate session/token and force re-login
}

Type guard

null

Try / catch

try {
    uacLoginService.loginAfter(request, loginName);
} catch (UacBizException e) {
    if (ErrorCodeEnum.UAC10011002.getCode().equals(e.getCode())) {
        securityContext.logout();
        throw new AuthException("account no longer exists; please log in again");
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling loginAfter (or hitting an endpoint that runs it) with a loginName stored in the session/token that no longer exists — account deleted after login, loginName renamed, or a stale/foreign cookie resolving to a nonexistent user.

Common situations: User deleted or renamed while their session token was still valid; Redis/session cache surviving a database reset or environment switch; SSO passing a loginName from an external directory that isn't synced into the uac user table.

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/657c330c9fc41d40. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacLoginServiceImpl.java:63

	@Resource
	private UacUserService uacUserService;
	@Resource
	private UacMenuService uacMenuService;

	@Override
	public LoginRespDto loginAfter(Long applicationId) {
		LoginRespDto loginRespDto = new LoginRespDto();
		String loginName = SecurityUtils.getCurrentLoginName();
		if (StringUtils.isEmpty(loginName)) {
			log.error("操作超时, 请重新登录 loginName={}", loginName);
			Preconditions.checkArgument(StringUtils.isNotEmpty(loginName), "操作超时, 请重新登录");
		}

		UacUser uacUser = uacUserService.findByLoginName(loginName);
		if (PublicUtil.isEmpty(uacUser)) {
			log.info("找不到用户信息 loginName={}", loginName);
			throw new UacBizException(ErrorCodeEnum.UAC10011002, loginName);
		}

		LoginAuthDto loginAuthDto = this.getLoginAuthDto(uacUser);
		List<MenuVo> menuVoList = uacMenuService.getMenuVoList(uacUser.getId(), applicationId);
		if (PublicUtil.isNotEmpty(menuVoList) && UacConstant.MENU_ROOT.equals(menuVoList.get(0).getMenuCode())) {
			menuVoList = menuVoList.get(0).getSubMenu();
		}
		loginRespDto.setLoginAuthDto(loginAuthDto);
		loginRespDto.setMenuList(menuVoList);
		return loginRespDto;
	}

	private LoginAuthDto getLoginAuthDto(UacUser uacUser) {
		LoginAuthDto loginAuthDto = new LoginAuthDto();
		loginAuthDto.setUserId(uacUser.getId());
		loginAuthDto.setUserName(uacUser.getUserName());
		loginAuthDto.setLoginName(uacUser.getLoginName());
		return loginAuthDto;

View on GitHub (pinned to 781281a950)