jumpserver/jumpserver · error · JMSException

response.body.message

Error message

response.body.message

What it means

JMSException raised in AlibabaSMS.send_sms() when the Alibaba Cloud SMS API responds but response.body.code is anything other than 'OK'. The detail is the provider's own message (e.g. insufficient balance, invalid template, frequency limit) and the code is the Alibaba error code.

Source

Thrown at apps/common/sdk/sms/alibaba.py:53

        config.endpoint = 'dysmsapi.aliyuncs.com'
        self.client = Dysmsapi20170525Client(config)

    def send_sms(self, phone_numbers: list, sign_name: str, template_code: str, template_param: dict, **kwargs):
        phone_numbers_str = ','.join(phone_numbers)
        send_sms_request = dysmsapi_20170525_models.SendSmsRequest(
            phone_numbers=phone_numbers_str, sign_name=sign_name,
            template_code=template_code, template_param=json.dumps(template_param)
        )
        try:
            logger.info(f'Alibaba sms send: '
                        f'phone_numbers={phone_numbers} '
                        f'sign_name={sign_name} '
                        f'template_code={template_code} '
                        f'template_param={template_param}')
            response = self.client.send_sms(send_sms_request)
            # 这里只判断是否成功,失败抛出异常
            if response.body.code != 'OK':
                raise JMSException(detail=response.body.message, code=response.body.code)
        except TeaException as e:
            if e.code == 'SignatureDoesNotMatch':
                raise JMSException(code=e.code, detail=_('Signature does not match'))
            raise JMSException(code=e.code, detail=e.message)
        return response


client = AlibabaSMS

View on GitHub (pinned to 6ec464fabd)

Solutions

  1. Match the returned response.body.code against Alibaba's SMS error code table and address the specific cause
  2. Verify sign_name and template_code exactly match the approved values in the Alibaba console (case-sensitive)
  3. Ensure template_param keys match the template's variable placeholders
  4. Check account balance and request quota/rate-limit increases for production volume
Defensive patterns

Strategy: try-catch

Validate before calling

if not sign_name or not template_code:
    raise ValueError('sign_name and template_code required for alibaba backend')

Try / catch

try:
    sms.send_sms(numbers, sign, tmpl, params)
except JMSException as e:
    if str(getattr(e, 'code', '')).startswith('isv.'):
        handle_alibaba_error_code(e.code)  # map provider code to user message
    raise

Prevention

When it happens

Trigger: send_sms() invoked with an unapproved sign_name, an invalid/inactive template_code, phone numbers in a region not covered, hitting SMS send frequency limits, or an account with insufficient balance — Alibaba returns codes like isv.BUSINESS_LIMIT_CONTROL, isv.SMS_SIGNATURE_ILLEGAL, or isv.AMOUNT_NOT_ENOUGH.

Common situations: New Alibaba SMS setup where the signature/template is still pending approval; production traffic hitting FlowControl limits; template_param variables not matching the template's declared placeholders; account balance exhausted.

Related errors


AI-assisted analysis of jumpserver/jumpserver@6ec464fabd (2026-08-28). Data as JSON: /api/errors/08ea1dae9d62e16c. Report an issue: GitHub.