{"record":{"id":"cc3410fb6b1bdc8d","repo":"DIYgod/RSSHub","slug":"uid-bilibili-cookie-cc3410","errorCode":null,"errorMessage":"缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值","messagePattern":"缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/message-at.ts","lineNumber":89,"sourceCode":"    message: string;\n    ttl: number;\n    data: {\n        cursor: {\n            is_end: boolean;\n            id: number;\n            time: number;\n        };\n        items: AtItem[];\n    };\n}\n\nasync function handler(ctx) {\n    const uid = ctx.req.param('uid');\n    const name = await cache.getUsernameFromUID(uid);\n\n    const cookie = config.bilibili.cookies[uid];\n    if (cookie === undefined) {\n        throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');\n    }\n\n    const response = await ofetch<AtResponse>('https://api.bilibili.com/x/msgfeed/at', {\n        query: {\n            platform: 'web',\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 ?? `Error code ${response.code}`);\n    }\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/message-at.ts#L71-L107","documentation":"ConfigNotFoundError thrown by the message-at ('@ mentions') route when config.bilibili.cookies[uid] is undefined. This route fetches the user's @-mention notifications from /x/msgfeed/at, which is strictly private/account-scoped data requiring authentication. Without the cookie, the API call cannot be made.","triggerScenarios":"Requesting /bilibili/messages/at/:uid without BILIBILI_COOKIE_<uid> configured. The msgfeed API requires the account owner's session to read their personal mention notifications.","commonSituations":"Cookie not configured for the uid; uid in route doesn't match any env var; new deployment without the bilibili cookie setup step.","solutions":["Set BILIBILI_COOKIE_<uid> with a cookie from the account whose mentions you want.","Ensure the uid in the env var name matches the route parameter.","Restart RSSHub after configuration."],"exampleFix":"// before: no cookie for message routes\n\n// after\nBILIBILI_COOKIE_123456=SESSDATA=xxx; bili_jct=xxx; DedeUserID=123456;","handlingStrategy":"validation","validationCode":"const uid = ctx.req.param('uid');\nif (!config.bilibili.cookies?.[uid]) {\n    throw new ConfigNotFoundError(`Set BILIBILI_COOKIE_${uid} to read @ mentions`);\n}","typeGuard":"function hasMessageCookie(uid: string): boolean {\n    return typeof config.bilibili.cookies?.[uid] === 'string';\n}","tryCatchPattern":null,"preventionTips":["Message routes are strictly private — always require a cookie.","Configure cookies for every uid used in message subscriptions.","Validate at startup."],"tags":["bilibili","messages","config","cookie","authentication","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}