{"record":{"id":"8ffa312fd9e7845c","repo":"iflytek/astron-agent","slug":"messagecodeservice-not-configured-skipping-verification-code","errorCode":null,"errorMessage":"messageCodeService not configured, skipping verification code check","messagePattern":"messageCodeService not configured, skipping verification code check","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":299,"sourceCode":"            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":281,"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#L281-L313","documentation":"WARN log from sendMessageCode when messageCodeService is null: the SMS verification service is not configured, so no code can be sent. The endpoint still returns success even though nothing was sent, which can mislead callers.","triggerScenarios":"Calling the send-message-code endpoint in an environment where MessageCodeService is not wired (no SMS provider config).","commonSituations":"Dev/test/staging deployments without SMS credentials; feature-flagged SMS integration left disabled in production by config mistake.","solutions":["Configure the SMS provider so the MessageCodeService bean is registered (check application.yml/profile for SMS credentials).","Return an explicit error or feature-not-available response instead of success when messageCodeService == null.","Add a startup check that fails fast (or logs an ERROR) if space deletion requires SMS but the service is absent."],"exampleFix":"// before\n} else {\n    log.warn(\"messageCodeService not configured, skipping verification code check\");\n}\nreturn ApiResult.success();\n// after\n} else {\n    log.error(\"messageCodeService not configured\");\n    return ApiResult.error(ResponseEnum.SMS_SERVICE_NOT_CONFIGURED);\n}","handlingStrategy":"fallback","validationCode":"// deployment check\n// assert messageCodeService != null at startup when sms enabled:\nApplicationRunner checker = ctx -> { if (ctx.getBeanProvider(MessageCodeService.class).getIfAvailable() == null) log.error(\"MessageCodeService missing: SMS verification disabled\"); };","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a startup assertion that MessageCodeService exists in environments that require SMS.","Keep SMS credentials in all active spring profiles, not only prod.","Alert on this WARN in production deployments."],"tags":["verification-code","sms","configuration","missing-bean"],"backgroundTag":"missing-required-config","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"}