apache/shenyu · error · AlertNoticeException
responseEntity.getBody().getErrMsg()
Error message
responseEntity.getBody().getErrMsg()
What it means
DingTalkRobotAlertNotifyStrategy.send throws AlertNoticeException with the DingTalk API's errMsg when the webhook responds HTTP 200 but the body errCode != 0. DingTalk returns 200 with an error payload for logical failures (invalid keyword, wrong secret, rate limited). This means the alert was NOT delivered even though the HTTP call succeeded.
Solutions
- Read the errMsg in the exception/log — it names the DingTalk-specific failure
- Align the robot's security settings (custom keyword, sign/secret, IP allowlist) with what the strategy sends
- Verify the webhook URL and access_token are valid and the robot is still in the group
- Rate-limit alert sending if errMsg indicates too many requests
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure alert text satisfies robot keyword filter and secret matches
String text = alert.getContent();
if (keyword != null && !text.contains(keyword)) {
throw new IllegalStateException("alert text must contain robot keyword");
} Try / catch
try {
strategy.send(noticeConfig, alert);
} catch (AlertNoticeException e) {
log.warn("DingTalk alert rejected: {}", e.getMessage());
// fall back to another alert channel
} Prevention
- Keep the robot's custom-keyword list in sync with alert message templates
- Re-verify access_token and secret after rotating bots
- Rate-limit alerts to stay under DingTalk's per-minute limit
When it happens
Trigger: Sending a DingTalk robot webhook alert where the response body has errCode != 0, e.g. errcode 310000 (keyword/sign mismatch), 130101 (bot disabled), or msg send limit exceeded.
Common situations: Robot security settings changed (custom keyword added that alert text doesn't contain); secret/sign misconfigured after rotating keys; robot removed from the group; exceeding DingTalk's 20 msgs/min rate limit.
Related errors
- Http StatusCode " + responseEntity.getStatusCode()
- [DingTalk Notify Error] " + e.getMessage()
- group param invalid
- Failed to get Swagger document, HTTP status code:
- Response body is empty
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/ebfc2f1371f6b734.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-alert/src/main/java/org/apache/shenyu/alert/strategy/DingTalkRobotAlertNotifyStrategy.java:64
try {
DingTalkWebHookDto dingTalkWebHookDto = new DingTalkWebHookDto();
MarkdownDTO markdownDTO = new MarkdownDTO();
markdownDTO.setText(renderContent(alert));
markdownDTO.setTitle(alert.getTitle());
dingTalkWebHookDto.setMarkdown(markdownDTO);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<DingTalkWebHookDto> httpEntity = new HttpEntity<>(dingTalkWebHookDto, headers);
String webHookUrl = DING_TALK_WEB_HOOK_URL + receiver.getAccessToken();
ResponseEntity<CommonRobotNotifyResp> responseEntity = getRestTemplate().postForEntity(webHookUrl,
httpEntity, CommonRobotNotifyResp.class);
if (responseEntity.getStatusCode() == HttpStatus.OK) {
Objects.requireNonNull(responseEntity.getBody());
if (responseEntity.getBody().getErrCode() == 0) {
log.debug("Send dingTalk webHook: {} Success", webHookUrl);
} else {
log.warn("Send dingTalk webHook: {} Failed: {}", webHookUrl, responseEntity.getBody().getErrMsg());
throw new AlertNoticeException(responseEntity.getBody().getErrMsg());
}
} else {
log.warn("Send dingTalk webHook: {} Failed: {}", webHookUrl, responseEntity.getBody());
throw new AlertNoticeException("Http StatusCode " + responseEntity.getStatusCode());
}
} catch (Exception e) {
throw new AlertNoticeException("[DingTalk Notify Error] " + e.getMessage());
}
}
@Override
public byte type() {
return 5;
}
@Override
protected String templateName() {
return "alertNotifyDingTalkRobot";View on GitHub (pinned to 567142e072)