{"record":{"id":"a10d75d8ce676a58","repo":"DIYgod/RSSHub","slug":"response-message-response-msg-error-code-a10d75","errorCode":null,"errorMessage":"response.message ?? response.msg ?? `Error code ${response.code}`","messagePattern":"response\\.message \\?\\? response\\.msg \\?\\? `Error code (.+?)`","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/message-system.ts","lineNumber":109,"sourceCode":"    const cookie = config.bilibili.cookies[uid];\n    if (cookie === undefined) {\n        throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');\n    }\n\n    const response = await ofetch<SystemResponse>('https://message.bilibili.com/x/sys-msg/query_user_notify', {\n        query: {\n            page_size: 20,\n            build: 0,\n            mobi_app: 'web',\n        },\n        headers: {\n            Referer: 'https://message.bilibili.com/',\n            Cookie: cookie,\n        },\n    });\n\n    if (response.code !== 0) {\n        throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);\n    }\n\n    const items: DataItem[] = (response.data.system_notify_list || []).map((item) => {\n        let description = `<p><strong>${item.title}</strong></p>`;\n        const parsedContent = parseMessageContent(item.content);\n        description += `<p>${parsedContent.replaceAll('\\n', '<br>')}</p>`;\n\n        if (item.source.logo) {\n            description += `<p><img src=\"${item.source.logo.replace('http://', 'https://')}\" width=\"40\" /></p>`;\n        }\n\n        if (item.card_cover) {\n            description += `<p><img src=\"${item.card_cover.replace('http://', 'https://')}\" /></p>`;\n        }\n\n        const link = item.card_link || 'https://message.bilibili.com/#/system';\n\n        return {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/message-system.ts#L91-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired SESSDATA; cookie missing bili_jct/DedeUserID; aggressive polling triggered risk control; bilibili swapped the error-text field name (hence the defensive ?? chain).","solutions":["Re-login to bilibili.com and replace BILIBILI_COOKIE_{uid} with the complete fresh Cookie.","Map the code to a cause: -101 invalid session, -352/-799 risk control, -403 permission denied.","Raise the RSS reader poll interval (>= 10 min); do not run duplicate instances against one account.","Confirm DedeUserID in the cookie equals the uid in the path."],"exampleFix":"// before\nif (response.code !== 0) {\n    throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);\n}\n\n// after\nif (response.code !== 0) {\n    if (response.code === -101) {\n        throw new ConfigNotFoundError(`Cookie for uid ${uid} expired (code -101). Update BILIBILI_COOKIE_${uid}.`);\n    }\n    throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);\n}","handlingStrategy":"retry","validationCode":"import ofetch from '@/utils/ofetch';\nimport { config } from '@/config';\nasync function cookieValid(uid: string) {\n  const cookie = config.bilibili.cookies[uid];\n  if (!cookie) return false;\n  const r = await ofetch<{ code: number }>('https://api.bilibili.com/x/web-interface/nav', { headers: { Cookie: cookie } });\n  return r.code === 0;\n}","typeGuard":"interface SysEnv<T> { code: number; message?: string; msg?: string; data?: T }\nfunction isSysOk<T>(r: SysEnv<T>): r is SysEnv<T> & { code: 0; data: T } { return r.code === 0; }","tryCatchPattern":"try {\n  if (response.code !== 0) throw new Error(response.message ?? response.msg ?? `Error code ${response.code}`);\n} catch (e) {\n  const m = e instanceof Error ? e.message : '';\n  if (m.includes('-101')) throw new Error(`Refresh BILIBILI_COOKIE_${uid}`);\n  if (m.includes('-352') || m.includes('-799')) await backoffRetry();\n  throw e;\n}","preventionTips":["Health-check cookies via /x/web-interface/nav; alert on -101.","Cache system-notify output for several minutes.","Poll >= 10 minute intervals; never duplicate instances per account.","Verify DedeUserID matches the path uid."],"tags":["bilibili","api-error","authentication","anti-crawler","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}