{"record":{"id":"ce6c6ed32b7a8179","repo":"paascloud/paascloud-master","slug":"opc10040004","errorCode":"OPC10040004","errorMessage":"OPC10040004","messagePattern":"OPC10040004","errorType":"error_code","errorClass":"OpcBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-opc/src/main/java/com/paascloud/provider/service/impl/OptSmsServiceImpl.java","lineNumber":62,"sourceCode":"\tprivate String profile;\n\n\t@Override\n\tpublic SendSmsResponse sendSms(SendSmsRequest sendSmsRequest) {\n\t\tcheckParam(sendSmsRequest);\n\t\tSendSmsResponse acsResponse;\n\t\ttry {\n\t\t\tif (GlobalConstant.DEV_PROFILE.equals(profile)) {\n\t\t\t\tlog.error(\"dev环境不发送短信\");\n\t\t\t\treturn new SendSmsResponse();\n\t\t\t}\n\t\t\tif (GlobalConstant.TEST_PROFILE.equals(profile)) {\n\t\t\t\tlog.error(\"test环境不发送短信\");\n\t\t\t\treturn new SendSmsResponse();\n\t\t\t}\n\t\t\tacsResponse = iAcsClient.getAcsResponse(sendSmsRequest);\n\t\t} catch (ClientException e) {\n\t\t\tlog.error(\"send sms message error={}\", e.getMessage(), e);\n\t\t\tthrow new OpcBizException(ErrorCodeEnum.OPC10040004, e);\n\t\t}\n\t\tlog.info(\"send sms message OK acsResponse={}\", acsResponse);\n\t\treturn acsResponse;\n\t}\n\n\tprivate void checkParam(SendSmsRequest sendSmsRequest) {\n\t\tString templateCode = sendSmsRequest.getTemplateCode();\n\t\tString signName = sendSmsRequest.getSignName();\n\t\tif (StringUtils.isBlank(signName)) {\n\t\t\tsendSmsRequest.setSignName(paascloudProperties.getAliyun().getSms().getSignName());\n\t\t}\n\n\t\tString templateParam = sendSmsRequest.getTemplateParam();\n\t\tString phoneNumbers = sendSmsRequest.getPhoneNumbers();\n\n\t\tPreconditions.checkArgument(StringUtils.isNotEmpty(templateCode), \"短信模板不能为空\");\n\t\tPreconditions.checkArgument(StringUtils.isNotEmpty(phoneNumbers), \"手机号码不能为空\");\n\t\tPreconditions.checkArgument(StringUtils.isNotEmpty(templateParam), \"短信内容不能为空\");","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-opc/src/main/java/com/paascloud/provider/service/impl/OptSmsServiceImpl.java#L44-L80","documentation":"OPC10040004 (\"发送短信失败\") is thrown by OptSmsServiceImpl.sendSms when the Aliyun Dysmsapi call iAcsClient.getAcsResponse(sendSmsRequest) raises a ClientException. This wraps the Aliyun SDK client exception (network to Aliyun endpoint, invalid credentials/signature, throttling) as an OpcBizException after logging. The SMS was not confirmed sent.","triggerScenarios":"Calling sendSms (outside 'test' profile, which short-circuits) when the Aliyun SMS client throws ClientException: network unreachable, wrong accessKeyId/Secret, invalid signature or region, or SDK request malformed.","commonSituations":"Aliyun access keys rotated or missing in the environment; VPC/egress firewall blocking the dysmsapi endpoint; expired or unapproved SMS template/signature; exceeding Aliyun SMS rate limits; region endpoint misconfigured.","solutions":["Inspect the wrapped ClientException in the log ('send sms message error') for the Aliyun error code (e.g. SignatureDoesNotMatch, InvalidAccessKeyId).","Verify aliyun accessKeyId/accessKeySecret and SMS region configuration in the environment.","Confirm the SMS template code and sign name are approved and active in the Aliyun console.","Check network egress from the service host to the dysmsapi endpoint (curl the endpoint).","Retry transient network failures with backoff; for persistent credential errors fix the keys, not the retry."],"exampleFix":"// before: unguarded call surfaces raw ClientException\nacsResponse = iAcsClient.getAcsResponse(sendSmsRequest);\n// after: pre-validate credentials/config before sending\nif (StringUtils.isBlank(accessKeyId) || StringUtils.isBlank(accessKeySecret)) {\n    throw new IllegalStateException(\"aliyun sms credentials not configured\");\n}\nacsResponse = iAcsClient.getAcsResponse(sendSmsRequest);","handlingStrategy":"retry","validationCode":"if (StringUtils.isAnyBlank(smsAccessKeyId, smsAccessKeySecret, smsSignName, smsTemplateCode)) {\n    throw new IllegalStateException(\"Aliyun SMS configuration incomplete\");\n}\nif (!ValidateUtil.isMobileNumber(phone)) { throw new IllegalArgumentException(\"bad phone\"); }","typeGuard":null,"tryCatchPattern":"try {\n    smsService.sendSms(sendSmsRequest);\n} catch (OpcBizException e) {\n    if (e.getCode() == 10040004 && isTransient(e)) {\n        retryWithBackoff(() -> smsService.sendSms(sendSmsRequest), 3);\n    } else {\n        alertOps(e); // credential/config errors are not retryable\n        throw e;\n    }\n}","preventionTips":["Rotate and verify Aliyun credentials in a deploy checklist.","Monitor Aliyun SMS quotas and throttling limits.","Keep SMS templates/signatures approved before release.","Test endpoint connectivity from production network (VPC egress).","Log the Aliyun response code on every failure for fast triage."],"tags":["sms","aliyun","network"],"backgroundTag":"api-request-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"}