{"record":{"id":"66a58121cc169836","repo":"paascloud/paascloud-master","slug":"uac10011022","errorCode":"UAC10011022","errorMessage":"UAC10011022","messagePattern":"UAC10011022","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/mq/producer/SmsProducer.java","lineNumber":61,"sourceCode":"\t\t\tPcSendSmsRequest request = new PcSendSmsRequest();\n\t\t\tMap<String, String> map = Maps.newHashMap();\n\t\t\t// 模板参数\n\t\t\tString smsParamName = templetEnum.getSmsParamName();\n\t\t\t// 模板编码\n\t\t\tString templetCode = templetEnum.getTempletCode();\n\t\t\t//替换模板验证码\n\t\t\tmap.put(smsParamName, smsMessage.getSmsCode());\n\t\t\tString param = JSON.toJSONString(map);\n\n\t\t\trequest.setPhoneNumbers(smsMessage.getMobileNo());\n\t\t\trequest.setTemplateCode(templetCode);\n\t\t\trequest.setTemplateParam(param);\n\t\t\trequest.setOutId(smsMessage.getOutId());\n\n\t\t\tmsgBody = JSON.toJSONString(request);\n\t\t} catch (Exception e) {\n\t\t\tlog.error(\"发送短信验证码 smsMessage转换为json字符串失败\", e);\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011022);\n\t\t}\n\t\tString topic = AliyunMqTopicConstants.MqTopicEnum.SEND_SMS_TOPIC.getTopic();\n\t\tString tag = AliyunMqTopicConstants.MqTagEnum.REGISTER_USER_AUTH_CODE.getTag();\n\t\tString key = RedisKeyUtil.createMqKey(topic, tag, smsMessage.getMobileNo(), msgBody);\n\t\treturn new MqMessageData(msgBody, topic, tag, key);\n\t}\n}\n","sourceCodeStart":43,"sourceCodeEnd":69,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/mq/producer/SmsProducer.java#L43-L69","documentation":"UacBizException with code UAC10011022 is thrown by SmsProducer.sendSmsCodeMq when JSON.toJSONString(request) fails while serializing the SMS request built from a SmsMessage (phone number, template param, outId). The exception is logged as \"发送短信验证码 smsMessage转换为json字符串失败\" and rethrown, preventing the SMS verification-code message from reaching the SEND_SMS_TOPIC MQ topic.","triggerScenarios":"Calling sendSmsCodeMq with a SmsMessage whose constructed Aliyun request object cannot be serialized by fastjson — e.g. templateParam containing structures fastjson cannot handle, or a getter on the request throwing during serialization.","commonSituations":"Template param JSON with special characters or nested maps triggering fastjson issues; custom fields added to the request DTO with throwing getters; fastjson version upgrades changing serialization behavior.","solutions":["Read the logged stack trace for the underlying serialization cause","Ensure templateParam is a simple Map<String,String> or a JSON string, not a self-referencing object","Simplify the request DTO to plain fields and avoid getter side effects","Pin/align the fastjson version used by the project"],"exampleFix":"// before\nrequest.setTemplateParam(complexNestedObject);\n// after\nrequest.setTemplateParam(JSON.toJSONString(complexNestedObject));","handlingStrategy":"try-catch","validationCode":"try { JSON.parseObject(JSON.toJSONString(request), SendSmsRequest.class); } catch (Exception e) { /* invalid request */ }","typeGuard":null,"tryCatchPattern":"try { msgBody = JSON.toJSONString(request); } catch (Exception e) { log.error(\"sms request serialization failed, mobile={}\", smsMessage.getMobileNo(), e); throw new UacBizException(ErrorCodeEnum.UAC10011022); }","preventionTips":["Pass templateParam as a pre-serialized JSON string or simple Map<String,String>","Avoid getters with side effects on SMS request DTOs","Unit-test serialization of SmsMessage variants including null outId","Keep fastjson version aligned across producer and consumer modules"],"tags":["mq","json-serialization","sms","fastjson"],"backgroundTag":"json-serialization-failed","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}