DIYgod/RSSHub · error · WeChatMpError

wechat-mp: ${params.join(': ')} Consider raise an issue (men

Error message

wechat-mp: ${params.join(': ')}
Consider raise an issue (mentioning @Rongronggg9) with the article URL for further investigation

What it means

wechat-mp.ts builds a two-line error message via formatLog (the route prefix plus a request to file an issue mentioning @Rongronggg9) and throws it as a WeChatMpError. It is raised by the error() helper, which is also wired into WarningAsError: when toggleWerror(true) is active, ordinary warnings are promoted to this fatal error.

Source

Thrown at lib/utils/wechat-mp.ts:53

import { parseDate } from '@/utils/parse-date';

class WeChatMpError extends Error {
    constructor(message: string) {
        super(message);
        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);

View on GitHub (pinned to bed535e087)

Solutions

  1. Disable WarningAsError for the wechat-mp route so warnings log instead of throwing.
  2. Inspect the article URL in the error message and report it to the maintainer if the page structure has genuinely changed.
  3. Verify the WeChat MP fetch path (proxy, UA, cookies) is healthy so the underlying warning condition disappears.

Example fix

// before
// WarningAsError on -> warning promoted to WeChatMpError
// after
toggleWerror(false); // warnings log instead of throw
Defensive patterns

Strategy: try-catch

Validate before calling

function shouldHardFail(): boolean {
  // reflect your WECHAT_MP_WARNING_AS_ERROR config
  return String(process.env?.WECHAT_MP_WARNING_AS_ERROR ?? '').toLowerCase() !== 'true';
}
if (!shouldHardFail()) { /* warnings stay warnings */ }

Type guard

const isWeChatMpError = (e: unknown): boolean =>
  e instanceof Error && /^wechat-mp:/.test(e.message);

Try / catch

try {
  return await parseWeChatMp(url);
} catch (e) {
  if (e instanceof WeChatMpError && /Consider raise an issue/.test(e.message)) {
    logger.warn(e.message); // demote to warning, keep serving
    return fallbackItem;
  }
  throw e;
}

Prevention

When it happens

Trigger: The WeChat MP article extractor encounters a recoverable condition (e.g. content extraction warning) while WarningAsError is on, or any code path calls error(...) directly with a fatal failure such as an unrecognised page structure.

Common situations: Running wechat-mp routes with WECHAT_MP_WARNING_AS_ERROR (or equivalent config) enabled; Tencent changing the mp.weixin.qq.com HTML so a previously-warning branch now hard-fails; network/proxy issues surfacing as errors during article fetch.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/4b103b0c63b27f36. Report an issue: GitHub.