paascloud/paascloud-master · warning · UacBizException

UAC10011013

UAC10011013

Error message

手机号已存在

What it means

UAC10011013 is thrown during registration when a UacUser template with the requested mobileNo yields selectCount > 0, i.e. another account already uses that phone number. Registration is rejected with '手机号已存在' to keep mobile numbers unique.

Solutions

  1. Check availability first (SELECT COUNT(*) FROM uac_user WHERE mobile_no = ?) or use the mobile-availability validation endpoint.
  2. If the number belongs to your old account, log in with it or unbind the mobile from that account before registering.
  3. In tests, generate unique mobile numbers per run instead of fixed fixtures.
  4. Add a DB UNIQUE constraint on mobile_no to prevent race-condition duplicates.

Example fix

// before
UacUser q = new UacUser(); q.setMobileNo(registerDto.getMobileNo());
if (uacUserMapper.selectCount(q) > 0) { throw new UacBizException(ErrorCodeEnum.UAC10011013); }
// after (client-side pre-check)
if (!uacUserService.checkMobileAvailable(registerDto.getMobileNo())) {
    return response("mobile number already registered");
}
Defensive patterns

Strategy: validation

Validate before calling

UacUser q = new UacUser();
q.setMobileNo(requestedMobile.trim());
if (uacUserMapper.selectCount(q) > 0) {
    return Result.fail("mobile number already registered");
}

Try / catch

try {
    uacUserService.register(registerDto);
} catch (UacBizException e) {
    if ("UAC10011013".equals(e.getCode())) { return Result.fail(409, "mobile number already exists"); }
    throw e;
}

Prevention

When it happens

Trigger: Registering with a phone number already bound to an existing account; re-registering while an older account still holds the number; shared/corporate phone numbers; concurrent registrations with the same mobileNo.

Common situations: Users switching accounts but reusing a phone; recycled phone numbers from carriers; test suites reusing fixture phone numbers; data imported from legacy systems keeping the old binding.

Related errors


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

Appendix: source

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

		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)