{"record":{"id":"373a0b8774d821d6","repo":"iflytek/astron-agent","slug":"user-has-not-bound-mobile-number-cannot-send-verification","errorCode":null,"errorMessage":"User has not bound mobile number, cannot send verification code, uid: {}","messagePattern":"User has not bound mobile number, cannot send verification code, uid: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/space/impl/SpaceBizServiceImpl.java","lineNumber":296,"sourceCode":"        }\n        if (space.getEnterpriseId() != null) {\n            EnterpriseUser enterpriseUser = enterpriseUserService.getEnterpriseUserByUid(space.getEnterpriseId(), uid);\n            if (enterpriseUser == null) {\n                return ApiResult.error(ResponseEnum.SPACE_USER_NOT_ENTERPRISE_USER);\n            }\n            if (!(Objects.equals(enterpriseUser.getRole(), EnterpriseRoleEnum.OFFICER.getCode()) ||\n                    Objects.equals(enterpriseUser.getRole(), EnterpriseRoleEnum.GOVERNOR.getCode()))) {\n                return ApiResult.error(ResponseEnum.SPACE_USER_NOT_ENTERPRISE_ADMIN);\n            }\n        }\n        // Get user mobile number and send SMS\n        if (messageCodeService != null) {\n            UserInfo userInfo = userInfoDataService.findByUid(uid).orElseThrow();\n            if (StringUtils.isNotBlank(userInfo.getMobile())) {\n                messageCodeService.sendVerifyCodeCommon(userInfo.getMobile(),\n                        MessageCodeService.DEL_SPACE_VERIFY_CODE_PREFIX);\n            } else {\n                log.warn(\"User has not bound mobile number, cannot send verification code, uid: {}\", uid);\n            }\n        } else {\n            log.warn(\"messageCodeService not configured, skipping verification code check\");\n        }\n\n        return ApiResult.success();\n    }\n\n    @Override\n    public ApiResult<Boolean> ossVersionUserUpgrade() {\n        String uid = RequestContextUtil.getUID();\n        return ApiResult.success(userInfoDataService.updateUserEnterpriseServiceType(uid, EnterpriseServiceTypeEnum.ENTERPRISE));\n    }\n\n\n}\n","sourceCodeStart":278,"sourceCodeEnd":313,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/space/impl/SpaceBizServiceImpl.java#L278-L313","documentation":"WARN log from sendMessageCode: the user identified by uid has no mobile number bound in user_info, so the delete-space verification SMS cannot be sent. It is not an exception; the endpoint still returns success while no code was actually delivered.","triggerScenarios":"Calling sendMessageCode for a user whose userInfo.getMobile() is blank/null, while messageCodeService is configured.","commonSituations":"Users who registered via email/WeChat and never bound a phone number trying to delete a space; users whose profile migration lost the mobile field.","solutions":["Have the user bind a mobile number to their account (profile/bind-mobile endpoint) before requesting a verification code.","Return an explicit error (e.g. MOBILE_NOT_BOUND) instead of ApiResult.success() so the client knows no SMS was sent.","Check user info via findByUid and validate mobile presence before calling this API."],"exampleFix":"// before\nlog.warn(\"User has not bound mobile number...\");\nreturn ApiResult.success();\n// after\nif (StringUtils.isBlank(userInfo.getMobile())) {\n    return ApiResult.error(ResponseEnum.MOBILE_NOT_BOUND);\n}","handlingStrategy":"validation","validationCode":"UserInfo u = userInfoDataService.findByUid(uid).orElse(null);\nif (u == null || StringUtils.isBlank(u.getMobile())) {\n    return ApiResult.error(ResponseEnum.MOBILE_NOT_BOUND);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check that the account has a bound mobile before initiating space deletion.","Prompt users to bind a phone number during onboarding.","Never assume success from sendMessageCode — verify an SMS was sent."],"tags":["verification-code","sms","user-profile","mobile-not-bound"],"backgroundTag":"missing-required-argument","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}