{"record":{"id":"9ebb73dc919ded96","repo":"apache/dolphinscheduler","slug":"itemslist-is-null-9ebb73","errorCode":null,"errorMessage":"itemsList is null","messagePattern":"itemsList is null","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java","lineNumber":117,"sourceCode":"            log.info(\"Enterprise WeChat send [{}], param:{}, resp:{}\",\n                    url, data, resp);\n            return resp;\n        }\n    }\n\n    /**\n     * convert text to markdown style\n     *\n     * @param title   the title\n     * @param content the content\n     * @return markdown text\n     */\n    private static String markdownText(String title, String content) {\n        if (StringUtils.isNotEmpty(content)) {\n            List<LinkedHashMap> mapItemsList = JSONUtils.toList(content, LinkedHashMap.class);\n            if (null == mapItemsList || mapItemsList.isEmpty()) {\n                log.error(\"itemsList is null\");\n                throw new RuntimeException(\"itemsList is null\");\n            }\n\n            StringBuilder contents = new StringBuilder(100);\n            contents.append(String.format(\"`%s`%n\", title));\n            for (LinkedHashMap mapItems : mapItemsList) {\n\n                Set<Map.Entry<String, Object>> entries = mapItems.entrySet();\n                for (Entry<String, Object> entry : entries) {\n                    contents.append(WeChatAlertConstants.MARKDOWN_QUOTE);\n                    contents.append(entry.getKey()).append(\":\").append(entry.getValue());\n                    contents.append(WeChatAlertConstants.MARKDOWN_ENTER);\n                }\n\n            }\n            return contents.toString();\n        }\n        return null;\n    }","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java#L99-L135","documentation":"WeChatSender.markdownText parses the alert content string as a JSON array of LinkedHashMap objects to build the WeChat markdown message. If the content is non-empty but does not deserialize into a non-empty list (wrong shape or unparseable JSON), it logs 'itemsList is null' and throws this RuntimeException, refusing to send a malformed WeChat alert.","triggerScenarios":"An alert reaches the WeChat plugin whose content is not a JSON array of objects — e.g. plain text alert data, an empty array '[]', or JSON that JSONUtils.toList cannot parse, while the content string itself is non-empty.","commonSituations":"Wiring a WeChat (markdown) alert to alert data produced for a different plugin (e.g. email/plain text formats); upstream alert payload format changed; alert content column contains text instead of the expected JSON list of maps.","solutions":["Ensure the alert content is a JSON array of objects, e.g. '[{\"title\":\"x\",\"content\":\"y\"}]', matching what markdownText expects.","Check which alert template/format generated the content and switch the alert instance or template so it emits the list-of-maps JSON.","Validate the alert data JSON with a JSON parser before the alert fires to catch malformed payloads early."],"exampleFix":"// before: alert data passed to WeChat plugin\n\"task failed with exit code 1\"\n// after: JSON list of maps\n\"[{\\\"title\\\":\\\"task failed\\\",\\\"content\\\":\\\"exit code 1\\\"}]\"","handlingStrategy":"validation","validationCode":"List<LinkedHashMap> items = JSONUtils.toList(content, LinkedHashMap.class);\nif (StringUtils.isEmpty(content) || items == null || items.isEmpty()) {\n    throw new IllegalArgumentException(\"WeChat alert content must be a non-empty JSON array of objects: \" + content);\n}","typeGuard":"boolean isWeChatMarkdownPayload(String s) {\n    if (s == null || !s.trim().startsWith(\"[\")) return false;\n    List<LinkedHashMap> l = JSONUtils.toList(s, LinkedHashMap.class);\n    return l != null && !l.isEmpty();\n}","tryCatchPattern":"try {\n    weChatSender.send(alert);\n} catch (RuntimeException e) {\n    if (\"itemsList is null\".equals(e.getMessage())) {\n        log.error(\"Alert content is not a JSON list of maps; check the alert template: {}\", alert.getContent());\n    }\n}","preventionTips":["Keep alert content producers emitting a JSON array of objects for WeChat markdown alerts.","Do not reuse alert data formatted for email/text plugins with the WeChat plugin.","Unit-test the plugin with the exact content shape your alert template produces."],"tags":["alert-plugin","wechat","json-unmarshal-failed","unexpected-response-shape"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}