paascloud/paascloud-master · warning · UacBizException
UAC10011012
UAC10011012
Error message
登录名已存在
What it means
UAC10011012 is thrown during user registration (register) after uacUserMapper.selectCount on a UacUser template with the requested loginName returns > 0, meaning an account with that login name already exists. Registration is rejected with '登录名已存在' to preserve login-name uniqueness.
Solutions
- Check availability first (the validate endpoint or SELECT COUNT(*) FROM uac_user WHERE login_name = ?) and pick a different loginName.
- If it's your own duplicate, log in or use password reset instead of registering again.
- Clean up orphaned/partial registrations from failed test runs before re-registering.
- Add a DB UNIQUE constraint on login_name as a backstop against race-condition duplicates.
Example fix
// before
UacUser q = new UacUser(); q.setLoginName(registerDto.getLoginName());
if (uacUserMapper.selectCount(q) > 0) { throw new UacBizException(ErrorCodeEnum.UAC10011012); }
// after (client-side pre-check)
if (!uacUserService.checkLoginNameAvailable(registerDto.getLoginName())) {
return response("login name already taken, choose another");
} Defensive patterns
Strategy: validation
Validate before calling
UacUser q = new UacUser();
q.setLoginName(requestedLoginName.trim());
if (uacUserMapper.selectCount(q) > 0) {
return Result.fail("login name already taken, choose another");
} Try / catch
try {
uacUserService.register(registerDto);
} catch (UacBizException e) {
if ("UAC10011012".equals(e.getCode())) { return Result.fail(409, "login name already exists"); }
throw e;
} Prevention
- Offer a real-time login-name availability check on the form.
- Trim login names consistently; be deliberate about case sensitivity.
- Add a UNIQUE index on login_name as a race-condition backstop.
- Use unique credentials per run in automated tests.
When it happens
Trigger: Submitting the registration form with a loginName already taken; retrying a registration that partially succeeded earlier; case variations of an existing login name on case-insensitive collations; concurrent registrations of the same loginName racing past the check.
Common situations: Popular usernames already claimed; users forgetting they already registered; test scripts re-running registration with fixed credentials; environments sharing a database with different apps.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/305b5459e4d9e6db.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:960
return uacUserMenuService.batchSave(uacUserMenuList);
}
private void validateRegisterInfo(UserRegisterDto registerDto) {
String mobileNo = registerDto.getMobileNo();
Preconditions.checkArgument(!StringUtils.isEmpty(registerDto.getLoginName()), ErrorCodeEnum.UAC10011007.msg());
Preconditions.checkArgument(!StringUtils.isEmpty(registerDto.getEmail()), ErrorCodeEnum.UAC10011018.msg());
Preconditions.checkArgument(!StringUtils.isEmpty(mobileNo), "手机号不能为空");
Preconditions.checkArgument(!StringUtils.isEmpty(registerDto.getLoginPwd()), ErrorCodeEnum.UAC10011014.msg());
Preconditions.checkArgument(!StringUtils.isEmpty(registerDto.getConfirmPwd()), ErrorCodeEnum.UAC10011009.msg());
Preconditions.checkArgument(!StringUtils.isEmpty(registerDto.getRegisterSource()), "验证类型错误");
Preconditions.checkArgument(registerDto.getLoginPwd().equals(registerDto.getConfirmPwd()), "两次密码不一致");
UacUser uacUser = new UacUser();
uacUser.setLoginName(registerDto.getLoginName());
int count = uacUserMapper.selectCount(uacUser);
if (count > 0) {
throw new UacBizException(ErrorCodeEnum.UAC10011012);
}
uacUser = new UacUser();
uacUser.setMobileNo(registerDto.getMobileNo());
count = uacUserMapper.selectCount(uacUser);
if (count > 0) {
throw new UacBizException(ErrorCodeEnum.UAC10011013);
}
uacUser = new UacUser();
uacUser.setEmail(registerDto.getEmail());
count = uacUserMapper.selectCount(uacUser);
if (count > 0) {
throw new UacBizException(ErrorCodeEnum.UAC10011019);
}
}
}View on GitHub (pinned to 781281a950)