DIYgod/RSSHub · error

response.message ?? response.msg ?? `Error code ${response.c

Error message

response.message ?? response.msg ?? `Error code ${response.code}`

What it means

Raised by the message-system route when https://message.bilibili.com/x/sys-msg/query_user_notify returns a non-zero business code despite HTTP 200. The dual fallback (response.message ?? response.msg ?? `Error code N`) handles inconsistent upstream field naming. A non-zero code means the Cookie was sent but Bilibili rejected the call at the application layer.

Source

Thrown at lib/routes/bilibili/message-system.ts:109

    const cookie = config.bilibili.cookies[uid];
    if (cookie === undefined) {
        throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');
    }

    const response = await ofetch<SystemResponse>('https://message.bilibili.com/x/sys-msg/query_user_notify', {
        query: {
            page_size: 20,
            build: 0,
            mobi_app: 'web',
        },
        headers: {
            Referer: 'https://message.bilibili.com/',
            Cookie: cookie,
        },
    });

    if (response.code !== 0) {
        throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);
    }

    const items: DataItem[] = (response.data.system_notify_list || []).map((item) => {
        let description = `<p><strong>${item.title}</strong></p>`;
        const parsedContent = parseMessageContent(item.content);
        description += `<p>${parsedContent.replaceAll('\n', '<br>')}</p>`;

        if (item.source.logo) {
            description += `<p><img src="${item.source.logo.replace('http://', 'https://')}" width="40" /></p>`;
        }

        if (item.card_cover) {
            description += `<p><img src="${item.card_cover.replace('http://', 'https://')}" /></p>`;
        }

        const link = item.card_link || 'https://message.bilibili.com/#/system';

        return {

View on GitHub (pinned to bed535e087)

Solutions

  1. Re-login to bilibili.com and replace BILIBILI_COOKIE_{uid} with the complete fresh Cookie.
  2. Map the code to a cause: -101 invalid session, -352/-799 risk control, -403 permission denied.
  3. Raise the RSS reader poll interval (>= 10 min); do not run duplicate instances against one account.
  4. Confirm DedeUserID in the cookie equals the uid in the path.

Example fix

// before
if (response.code !== 0) {
    throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);
}

// after
if (response.code !== 0) {
    if (response.code === -101) {
        throw new ConfigNotFoundError(`Cookie for uid ${uid} expired (code -101). Update BILIBILI_COOKIE_${uid}.`);
    }
    throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);
}
Defensive patterns

Strategy: retry

Validate before calling

import ofetch from '@/utils/ofetch';
import { config } from '@/config';
async function cookieValid(uid: string) {
  const cookie = config.bilibili.cookies[uid];
  if (!cookie) return false;
  const r = await ofetch<{ code: number }>('https://api.bilibili.com/x/web-interface/nav', { headers: { Cookie: cookie } });
  return r.code === 0;
}

Type guard

interface SysEnv<T> { code: number; message?: string; msg?: string; data?: T }
function isSysOk<T>(r: SysEnv<T>): r is SysEnv<T> & { code: 0; data: T } { return r.code === 0; }

Try / catch

try {
  if (response.code !== 0) throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);
} catch (e) {
  const m = e instanceof Error ? e.message : '';
  if (m.includes('-101')) throw new Error(`Refresh BILIBILI_COOKIE_${uid}`);
  if (m.includes('-352') || m.includes('-799')) await backoffRetry();
  throw e;
}

Prevention

When it happens

Trigger: GET /bilibili/message/system/:uid with an expired (code -101), rate-limited, or risk-controlled cookie (-352/-799), or where the cookie account does not match the path uid.

Common situations: Expired SESSDATA; cookie missing bili_jct/DedeUserID; aggressive polling triggered risk control; bilibili swapped the error-text field name (hence the defensive ?? chain).

Related errors


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