yikart/AiToEarn · error · AppHttpException
ErrHttpBack.err_user_pop_code_null
ErrHttpBack.err_user_pop_code_null
Error message
err_user_pop_code_null
What it means
loginByPhoneCode accepts an optional inviteCode; if provided, it looks up the inviter by popularize code, and err_user_pop_code_null is thrown when no user owns that invite code — registration is blocked rather than silently dropping the referral.
Source
Thrown at project/aitoearn-electron/server/src/user/userLogin.controller.ts:84
}
@ApiOperation({
description: '手机号验证码登录',
summary: '手机号验证码登录',
})
@Public()
@Post('login/code/phone')
async loginByPhoneCode(
@Body(new ParamsValidationPipe()) loginInfo: PhoneLoginByCodeDto,
) {
const { phone, code, inviteCode } = loginInfo;
// 邀请码验证
if (!!inviteCode) {
const inviteUserInfo =
await this.userService.getUserByPopularizeCode(inviteCode);
if (!inviteUserInfo)
throw new AppHttpException(ErrHttpBack.err_user_pop_code_null);
}
// 验证短信验证码
if (process.env.NODE_ENV !== 'development' && code !== 'yika888666') {
const res = await this.loginService.verifyPhoneCode(
phone,
code,
LoginTypeCacheKey.Code,
);
if (!res) throw new AppHttpException(ErrHttpBack.err_user_code_nohad);
}
let userInfo: User = await this.userService.getUserInfoByPhone(phone);
if (!userInfo) {
const newUser = new NewUserByPhone(phone);
if (!!inviteCode) newUser.inviteCode = inviteCode;
userInfo = await this.userService.createUser(newUser);
}View on GitHub (pinned to d3aa8bea5b)
Solutions
- Correct the invite code against the inviter's actual code
- Retry registration without the inviteCode (it is optional)
- Regenerate/share a fresh invite link from the inviter's account
Example fix
// before
await loginApi.loginByPhoneCode(phone, code, inviteCodeTyped); // typo
// after
try {
await loginApi.loginByPhoneCode(phone, code, inviteCodeTyped);
} catch (e) {
await loginApi.loginByPhoneCode(phone, code, undefined); // register w/o invite
} Defensive patterns
Strategy: validation
Validate before calling
if (inviteCode) {
const inviter = await userService.getUserByPopularizeCode(inviteCode);
if (!inviter) inviteCode = undefined; // drop invalid invite before login
} Type guard
function hasInvite(code?: string): code is string {
return typeof code === 'string' && code.trim().length > 0;
} Try / catch
try {
await loginApi.loginByPhoneCode(phone, code, inviteCode);
} catch (e) {
if (e.response?.message === 'err_user_pop_code_null') {
await loginApi.loginByPhoneCode(phone, code, undefined);
}
} Prevention
- Copy invite codes from links instead of typing them
- Validate invite code format before submission
- Make the invite field optional in the UI with a clear error path
When it happens
Trigger: POST phone-code login with an inviteCode that doesn't match any user's popularize code.
Common situations: User hand-typed an invite code with a typo; copied invite link truncated; inviter account deleted after sharing the code; sharing codes across environments with different user bases.
Related errors
- No subtitle entries in response
- No response from Gemini
- Invalid subtitle data: ${z.prettifyError(result.error)}
- Canvas not provided and no vid:// video source found in Trac
- Canvas not provided and failed to retrieve video dimensions
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/2af7e2223512c150.
Report an issue: GitHub.