{"record":{"id":"ebfc2f1371f6b734","repo":"apache/shenyu","slug":"responseentity-getbody-geterrmsg","errorCode":null,"errorMessage":"responseEntity.getBody().getErrMsg()","messagePattern":"responseEntity\\.getBody\\(\\)\\.getErrMsg\\(\\)","errorType":"exception","errorClass":"AlertNoticeException","httpStatus":null,"severity":"error","filePath":"shenyu-alert/src/main/java/org/apache/shenyu/alert/strategy/DingTalkRobotAlertNotifyStrategy.java","lineNumber":64,"sourceCode":"        try {\n            DingTalkWebHookDto dingTalkWebHookDto = new DingTalkWebHookDto();\n            MarkdownDTO markdownDTO = new MarkdownDTO();\n            markdownDTO.setText(renderContent(alert));\n            markdownDTO.setTitle(alert.getTitle());\n            dingTalkWebHookDto.setMarkdown(markdownDTO);\n            HttpHeaders headers = new HttpHeaders();\n            headers.setContentType(MediaType.APPLICATION_JSON);\n            HttpEntity<DingTalkWebHookDto> httpEntity = new HttpEntity<>(dingTalkWebHookDto, headers);\n            String webHookUrl = DING_TALK_WEB_HOOK_URL + receiver.getAccessToken();\n            ResponseEntity<CommonRobotNotifyResp> responseEntity = getRestTemplate().postForEntity(webHookUrl,\n                    httpEntity, CommonRobotNotifyResp.class);\n            if (responseEntity.getStatusCode() == HttpStatus.OK) {\n                Objects.requireNonNull(responseEntity.getBody());\n                if (responseEntity.getBody().getErrCode() == 0) {\n                    log.debug(\"Send dingTalk webHook: {} Success\", webHookUrl);\n                } else {\n                    log.warn(\"Send dingTalk webHook: {} Failed: {}\", webHookUrl, responseEntity.getBody().getErrMsg());\n                    throw new AlertNoticeException(responseEntity.getBody().getErrMsg());\n                }\n            } else {\n                log.warn(\"Send dingTalk webHook: {} Failed: {}\", webHookUrl, responseEntity.getBody());\n                throw new AlertNoticeException(\"Http StatusCode \" + responseEntity.getStatusCode());\n            }\n        } catch (Exception e) {\n            throw new AlertNoticeException(\"[DingTalk Notify Error] \" + e.getMessage());\n        }\n    }\n    \n    @Override\n    public byte type() {\n        return 5;\n    }\n    \n    @Override\n    protected String templateName() {\n        return \"alertNotifyDingTalkRobot\";","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-alert/src/main/java/org/apache/shenyu/alert/strategy/DingTalkRobotAlertNotifyStrategy.java#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure alert text satisfies robot keyword filter and secret matches\nString text = alert.getContent();\nif (keyword != null && !text.contains(keyword)) {\n    throw new IllegalStateException(\"alert text must contain robot keyword\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    strategy.send(noticeConfig, alert);\n} catch (AlertNoticeException e) {\n    log.warn(\"DingTalk alert rejected: {}\", e.getMessage());\n    // fall back to another alert channel\n}","preventionTips":["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"],"tags":["dingtalk","webhook","alert","http"],"backgroundTag":"api-error-response","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}