louislam/uptime-kuma · error · Error
${result.data.errmsg}
Error message
${result.data.errmsg} What it means
dingding.js:78-80. After signing and POSTing to the DingTalk webhook (URL + timestamp + HMAC-SHA256 signature), the provider expects result.data.errmsg === 'ok'. Any other value — typically 'token is invalid', 'sign not match', 'keyword is not contained', or 'message size exceed' — is thrown verbatim.
Source
Thrown at server/notification-providers/dingding.js:80
*/
async sendToDingDing(notification, params) {
let timestamp = Date.now();
let config = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
url: `${notification.webHookUrl}×tamp=${timestamp}&sign=${encodeURIComponent(this.sign(timestamp, notification.secretKey))}`,
data: JSON.stringify(params),
};
config = this.getAxiosConfigWithProxy(config);
let result = await axios(config);
if (result.data.errmsg === "ok") {
return true;
}
throw new Error(result.data.errmsg);
}
/**
* DingDing sign
* @param {Date} timestamp Timestamp of message
* @param {string} secretKey Secret key to sign data with
* @returns {string} Base64 encoded signature
*/
sign(timestamp, secretKey) {
return Crypto.createHmac("sha256", Buffer.from(secretKey, "utf8"))
.update(Buffer.from(`${timestamp}\n${secretKey}`, "utf8"))
.digest("base64");
}
/**
* Convert status constant to string
* @param {const} status The status constant
* @returns {string} StatusView on GitHub (pinned to 6b5ea01557)
Solutions
- Map errmsg: 'token is invalid' → copy the current webhook URL; 'sign not match' → fix secretKey; 'keyword is not contained' → add the keyword to the alert template; size errors → shorten msg.
- In DingTalk, re-open the robot config and copy BOTH the webhook URL and the secret.
- Ensure secretKey has no leading/trailing whitespace when pasted.
- If a custom keyword security policy is set, include that keyword in monitor alert messages.
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate DingTalk webhook URL + secret + security keyword
function dingdingPreflight(notification, message) {
if (!/^https:\/\/oapi.dingtalk.com\/robot\/send\?access_token=/.test(notification.webHookUrl || ''))
throw new Error('DingTalk webhook URL invalid');
if (!notification.secretKey) throw new Error('DingTalk secretKey missing');
if (notification.securityKeyword && !message.includes(notification.securityKeyword))
throw new Error('Alert text missing DingTalk security keyword');
} Type guard
function isDingdingOkPayload(d) { return d && typeof d === 'object' && d.errcode === 0 && d.errmsg === 'ok'; } Try / catch
try { await provider.send(...); }
catch (e) {
if (/token is invalid/i.test(e.message)) log.error('DingTalk webhook token stale — recopy');
else if (/sign not match/i.test(e.message)) log.error('DingTalk secretKey mismatch — check whitespace');
else if (/keyword/i.test(e.message)) log.warn('Alert body missing configured DingTalk keyword');
} Prevention
- Re-copy BOTH webhook URL and secret whenever the robot is recreated in DingTalk.
- If using the keyword security policy, include that keyword in all alert templates.
When it happens
Trigger: Webhook URL/token removed or rotated (token is invalid), secretKey mismatch causing signature failure (sign not match), message body lacks the configured security keyword (keyword is not contained), or payload too large.
Common situations: DingTalk robot security setting 'custom keyword' enabled but the alert text does not contain it; secretKey copied with trailing whitespace breaking HMAC; webhook recreated in DingTalk producing a new URL/token not updated in Uptime Kuma.
Related errors
- Received unexpected status code ${result.status} from notifi
- Child monitors down: ${downChildren.join(", ")}; pending: ${
- No recipient or group specified
- ${result.data.Message}
- ${output}
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/ba39c917a852b703.
Report an issue: GitHub.