jumpserver/jumpserver · error · JMSException
e.message
Error message
e.message
What it means
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).
Source
Thrown at apps/common/sdk/sms/alibaba.py:57
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
- 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
Defensive patterns
Strategy: try-catch
Validate before calling
import re
valid = all(re.fullmatch(r'\+?\d{5,15}', p) for p in phone_numbers)
if not valid:
raise ValueError('invalid phone number format') Try / catch
try:
sms.send_sms(...)
except JMSException as e:
code = getattr(e, 'code', '')
if code in ('Forbidden.RAM', 'Forbidden'):
alert('RAM permissions missing for SMS')
raise Prevention
- Grant RAM user AliyunDysmsFullAccess up front
- Normalize phone numbers to E.164 before sending
- Pin the alibaba-sdk-python version
When it happens
Trigger: 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.
Common situations: RAM user lacking SMS permissions; malformed phone numbers (not E.164/local format expected); regional endpoint misconfiguration; SDK version drift changing exception shapes.
Related errors
AI-assisted analysis of jumpserver/jumpserver@6ec464fabd (2026-08-28).
Data as JSON: /api/errors/39adb516ce29148d.
Report an issue: GitHub.