{"record":{"id":"39adb516ce29148d","repo":"jumpserver/jumpserver","slug":"e-message","errorCode":null,"errorMessage":"e.message","messagePattern":"e\\.message","errorType":"exception","errorClass":"JMSException","httpStatus":null,"severity":"error","filePath":"apps/common/sdk/sms/alibaba.py","lineNumber":57,"sourceCode":"        phone_numbers_str = ','.join(phone_numbers)\n        send_sms_request = dysmsapi_20170525_models.SendSmsRequest(\n            phone_numbers=phone_numbers_str, sign_name=sign_name,\n            template_code=template_code, template_param=json.dumps(template_param)\n        )\n        try:\n            logger.info(f'Alibaba sms send: '\n                        f'phone_numbers={phone_numbers} '\n                        f'sign_name={sign_name} '\n                        f'template_code={template_code} '\n                        f'template_param={template_param}')\n            response = self.client.send_sms(send_sms_request)\n            # 这里只判断是否成功，失败抛出异常\n            if response.body.code != 'OK':\n                raise JMSException(detail=response.body.message, code=response.body.code)\n        except TeaException as e:\n            if e.code == 'SignatureDoesNotMatch':\n                raise JMSException(code=e.code, detail=_('Signature does not match'))\n            raise JMSException(code=e.code, detail=e.message)\n        return response\n\n\nclient = AlibabaSMS\n","sourceCodeStart":39,"sourceCodeEnd":62,"githubUrl":"https://github.com/jumpserver/jumpserver/blob/6ec464fabd61b95912d539455a3a5f15f5c59fe0/apps/common/sdk/sms/alibaba.py#L39-L62","documentation":"JMSException raised as the generic fallback for any TeaException from the Alibaba Cloud SDK that is not SignatureDoesNotMatch. The detail is the raw SDK exception message (e.g. InvalidPhoneNumber, Forbidden.RAM, SpeifyOnlyOneParam, network/endpoint issues).","triggerScenarios":"send_sms() where the SDK throws for reasons such as unauthorized RAM permissions (Forbidden), invalid phone number format, both setSignatureAndTemplate misconfigurations, SDK/endpoint errors, or throttling — any TeaException other than signature mismatch.","commonSituations":"RAM user lacking SMS permissions; malformed phone numbers (not E.164/local format expected); regional endpoint misconfiguration; SDK version drift changing exception shapes.","solutions":["Read the TeaException code in the raised JMSException (code=e.code) and look it up in Alibaba's error catalog","Grant the RAM user SMS permissions (AliyunDysmsFullAccess) if code indicates authorization failure","Validate phone number format before sending","Verify the SDK version and regional endpoint configuration"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import re\nvalid = all(re.fullmatch(r'\\+?\\d{5,15}', p) for p in phone_numbers)\nif not valid:\n    raise ValueError('invalid phone number format')","typeGuard":null,"tryCatchPattern":"try:\n    sms.send_sms(...)\nexcept JMSException as e:\n    code = getattr(e, 'code', '')\n    if code in ('Forbidden.RAM', 'Forbidden'):\n        alert('RAM permissions missing for SMS')\n    raise","preventionTips":["Grant RAM user AliyunDysmsFullAccess up front","Normalize phone numbers to E.164 before sending","Pin the alibaba-sdk-python version"],"tags":["alibaba","sdk-exception","fallback","permissions"],"backgroundTag":"alibaba-sdk-tea-exception","analyzedSha":"6ec464fabd61b95912d539455a3a5f15f5c59fe0","analyzedAt":"2026-08-28T11:33:00.925Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}