{"record":{"id":"37a42fe394432c0c","repo":"iflytek/astron-agent","slug":"messagecodeservice-not-configured-or-mobile-number-not","errorCode":null,"errorMessage":"messageCodeService not configured, or mobile number not provided, skipping verification code check","messagePattern":"messageCodeService not configured, or mobile number not provided, 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":140,"sourceCode":"    }\n\n    /**\n     * Delete space\n     *\n     * @param spaceId\n     * @param mobile\n     * @param verifyCode\n     * @return\n     */\n    @Override\n    @Transactional\n    public ApiResult<String> deleteSpace(Long spaceId, String mobile, String verifyCode) {\n        // Send verification code\n        if (messageCodeService != null && StringUtils.isNotBlank(mobile)) {\n            messageCodeService.checkVerifyCodeCommon(mobile, verifyCode,\n                    MessageCodeService.DEL_SPACE_VERIFY_CODE_PREFIX);\n        } else {\n            log.warn(\"messageCodeService not configured, or mobile number not provided, skipping verification code check\");\n        }\n        Space space = spaceService.getById(spaceId);\n        if (space == null) {\n            return ApiResult.error(ResponseEnum.SPACE_NOT_EXISTS);\n        }\n        String uid = RequestContextUtil.getUID();\n        // Enterprise space: verify user is enterprise admin via DB query (not header)\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        } else {\n            // Personal space: verify current user is the owner","sourceCodeStart":122,"sourceCodeEnd":158,"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#L122-L158","documentation":"This is a WARN log, not an exception, emitted by deleteSpace when the verification-code check for deleting a space is skipped. It fires when messageCodeService is null (SMS/verify-code service not configured) or the request carried no mobile number. Space deletion then proceeds without the second-factor check, which is a security-relevant degradation.","triggerScenarios":"Calling DELETE space endpoint without a mobile/verifyCode; or deploying the hub service without a MessageCodeService bean (SMS integration disabled).","commonSituations":"Local/dev environments where the SMS provider (messageCodeService) is intentionally disabled; API clients calling deleteSpace without the mobile parameter; partially configured spring profiles.","solutions":["Pass a non-blank mobile (and verifyCode) when calling deleteSpace so the verification check runs.","Configure the MessageCodeService bean / SMS provider credentials in the environment so messageCodeService != null.","If skipping is acceptable in a given env, treat this log as informational only; otherwise enforce mobile+code as required parameters at the controller level."],"exampleFix":"// before\nspaceBizService.deleteSpace(spaceId, null, null);\n// after\nApiResult<String> result = spaceBizService.deleteSpace(spaceId, mobile, verifyCode);\n// with controller-side validation: if (StringUtils.isBlank(mobile) || StringUtils.isBlank(verifyCode)) return ApiResult.error(PARAMETER_ERROR);","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(mobile) || StringUtils.isBlank(verifyCode)) {\n    throw new IllegalArgumentException(\"mobile and verifyCode are required to delete a space\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass mobile+verifyCode from the UI when deleting spaces.","Ensure the SMS/MessageCodeService bean is configured in every production profile.","Monitor for this WARN in production — it means two-factor deletion is disabled."],"tags":["verification-code","security","configuration","sms"],"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"}