{"record":{"id":"70200cd6f0191f94","repo":"DIYgod/RSSHub","slug":"message-code-70200c","errorCode":null,"errorMessage":"message ?? code","messagePattern":"message \\?\\? code","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/fav.ts","lineNumber":40,"sourceCode":"    maintainers: ['Qixingchen'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const fid = ctx.req.param('fid');\n    const uid = ctx.req.param('uid');\n    const embed = !ctx.req.param('embed');\n\n    const response = await got({\n        url: `https://api.bilibili.com/x/v3/fav/resource/list?media_id=${fid}&ps=20`,\n        headers: {\n            Referer: `https://space.bilibili.com/${uid}/`,\n            Cookie: config.bilibili.cookies[uid],\n        },\n    });\n    const { data, code, message } = response.data;\n    if (code) {\n        throw new Error(message ?? code);\n    }\n\n    const username = data.info.upper.name;\n    const favName = data.info.title;\n\n    return {\n        title: `${username} 的 bilibili 收藏夹 ${favName}`,\n        link: `https://space.bilibili.com/${uid}/#/favlist?fid=${fid}`,\n        description: `${username} 的 bilibili 收藏夹 ${favName}`,\n\n        item:\n            data.medias &&\n            data.medias.map((item) => ({\n                title: item.title,\n                description: utils.renderUGCDescription(embed, item.cover, item.intro, item.id, undefined, item.bvid),\n                pubDate: parseDate(item.fav_time * 1000),\n                link: item.fav_time > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.id}`,\n                author: item.upper.name,","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/fav.ts#L22-L58","documentation":"Thrown by the bilibili favorites (fav) route when the fav/resource/list API returns a non-zero code. The message is the API's own message (preferred) or the numeric code, propagated verbatim. The request already attached config.bilibili.cookies[uid], so a non-zero code usually means auth or visibility problems.","triggerScenarios":"Requesting /bilibili/fav/:uid/:fid and the API returns code != 0: the fav list is private, the cookie for uid is missing/expired, or fid does not belong to uid.","commonSituations":"config.bilibili.cookies[uid] unset or expired; target favorited folder set to private; fid typo or a folder that was deleted.","solutions":["Inspect the propagated code: -101 means the cookie for uid is invalid/missing (set config.bilibili.cookies[uid]); -403 means the folder is private.","Confirm fid is a public favorites folder owned by uid.","Re-copy the cookie from a logged-in bilibili.com session and restart RSSHub."],"exampleFix":"// before\nconst { data, code, message } = response.data;\nif (code) {\n    throw new Error(message ?? code);\n}\n\n// after\nif (code) {\n    if (code === -101) {\n        throw new ConfigNotFoundError(`bilibili cookie for uid ${uid} is missing or expired (code -101).`);\n    }\n    throw new Error(`bilibili fav API error for uid ${uid} fid ${fid}: ${message ?? code}`);\n}","handlingStrategy":"try-catch","validationCode":"const { code, message } = response.data ?? {};\nif (code) {\n    throw new Error(message ?? String(code));\n}","typeGuard":"function isBilibiliErrorEnvelope(r: any): boolean {\n    return r && typeof r.code === 'number' && r.code !== 0;\n}","tryCatchPattern":"try {\n    const { data, code, message } = response.data;\n    if (code) throw new Error(message ?? code);\n} catch (e) {\n    if (/^-101|-403/.test(String((e as Error).message))) {\n        // cookie expired or folder private — surface to operator\n    }\n    throw e;\n}","preventionTips":["Confirm the favorites folder (fid) is public and belongs to uid before requesting.","Keep config.bilibili.cookies[uid] fresh so auth codes do not surface to feed readers."],"tags":["bilibili","api-error","cookie","authentication","propagation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}