DIYgod/RSSHub · error · WeChatMpError
wechat-mp: ${params.join(': ')}
Error message
wechat-mp: ${params.join(': ')} What it means
wechat-mp.ts's errorNoMention helper throws a WeChatMpError whose message is built by formatLogNoMention - the 'wechat-mp: ...' prefix without the maintainer-mention suffix. It is used for failures that are the user's fault (bad URL, missing param) rather than upstream-page-change issues worth a GitHub issue.
Source
Thrown at lib/utils/wechat-mp.ts:58
this.name = 'WeChatMpError';
}
}
const MAINTAINERS = ['@Rongronggg9'];
const formatLogNoMention = (...params: string[]): string => `wechat-mp: ${params.join(': ')}`;
const formatLog = (...params: string[]): string => `${formatLogNoMention(...params)}
Consider raise an issue (mentioning ${MAINTAINERS.join(', ')}) with the article URL for further investigation`;
let warn = (...params: string[]) => logger.warn(formatLog(...params));
const error = (...params: string[]): never => {
const msg = formatLog(...params);
logger.error(msg);
throw new WeChatMpError(msg);
};
const errorNoMention = (...params: string[]): never => {
const msg = formatLogNoMention(...params);
logger.error(msg);
throw new WeChatMpError(msg);
};
const toggleWerror = (() => {
const onFunc = (...params: string[]) => error('WarningAsError', ...params);
const offFunc = warn;
return (on: boolean) => {
warn = on ? onFunc : offFunc;
};
})();
const replaceReturnNewline = (() => {
const returnRegExp = /\r|\\(r|x0d)/g;
const newlineRegExp = /\n|\\(n|x0a)/g;
return (text: string, replaceReturnWith = '', replaceNewlineWith = '<br>') => text.replaceAll(returnRegExp, () => replaceReturnWith).replaceAll(newlineRegExp, () => replaceNewlineWith);
})();
const fixUrl = (() => {
const ampRegExp = /(&|\\x26)amp;/g;
return (text: string) => text.replaceAll(ampRegExp, '&');
})();View on GitHub (pinned to bed535e087)
Solutions
- Validate the article URL is a valid mp.weixin.qq.com link before calling the route.
- Provide all required parameters documented for the route.
- If the failure is actually an upstream change, the route should be using error() (with mention) instead - report it.
Example fix
// before
errorNoMention('invalid url', url);
// after
if (!/^https:\/\/mp\.weixin\.qq\.com\/.+/.test(url)) {
throw new InvalidParameterError('Expected a mp.weixin.qq.com article URL');
} Defensive patterns
Strategy: validation
Validate before calling
function isValidWeChatMpUrl(url: string): boolean {
return /^https?:\/\/mp\.weixin\.qq\.com\/s[/?#]/.test(url);
}
if (!isValidWeChatMpUrl(url)) throw new InvalidParameterError('Expected mp.weixin.qq.com article URL'); Type guard
const isWeChatMpArticleUrl = (u: unknown): u is string => typeof u === 'string' && /^https?:\/\/mp\.weixin\.qq\.com\/s[/?#]/.test(u);
Try / catch
try {
return await parseWeChatMp(url);
} catch (e) {
if (e instanceof WeChatMpError && !/Consider raise an issue/.test(e.message)) {
return ctx.throw(400, e.message); // user-side error -> 400
}
throw e;
} Prevention
- Validate the article URL shape before invoking the route.
- Distinguish WeChatMpError variants by the 'Consider raise an issue' suffix: present => upstream issue, absent => user error.
- Surface errorNoMention failures to the caller as 4xx, not 5xx.
When it happens
Trigger: A caller invokes errorNoMention(...) for a self-contained failure such as an invalid article URL, a missing required parameter, or a network-level rejection that should not prompt the user to file an issue.
Common situations: Passing a malformed or non-weixin.qq.com URL to a wechat-mp route; missing required query parameters; regional blocking returning a non-200 status that the route treats as a user-side error.
Related errors
- wechat-mp: ${params.join(': ')} Consider raise an issue (men
- 文章列表不存在或为空
- TechFlow API returned an invalid article list.
- TechFlow API returned an invalid newsflash list.
- No articles found for category: ${category}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/2ddf707fdfed721d.
Report an issue: GitHub.