DIYgod/RSSHub · error · ConfigNotFoundError
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
Error message
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
What it means
Same ConfigNotFoundError pattern as the other bilibili message routes, this time for /bilibili/message/reply/:uid (replies-to-me feed). The handler reads config.bilibili.cookies[uid]; if undefined it throws before calling https://api.bilibili.com/x/msgfeed/reply, because that endpoint requires the logged-in user's session Cookie. The dedicated subclass lets RSSHub distinguish a missing-config condition from a runtime API failure.
Source
Thrown at lib/routes/bilibili/message-reply.ts:99
ttl: number;
data: {
cursor: {
is_end: boolean;
id: number;
time: number;
};
items: ReplyItem[];
last_view_at: number;
};
}
async function handler(ctx) {
const uid = ctx.req.param('uid');
const name = await cache.getUsernameFromUID(uid);
const cookie = config.bilibili.cookies[uid];
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');
}
const response = await ofetch<ReplyResponse>('https://api.bilibili.com/x/msgfeed/reply', {
query: {
platform: 'web',
build: 0,
mobi_app: 'web',
},
headers: {
Referer: 'https://message.bilibili.com/',
Cookie: cookie,
},
});
if (response.code !== 0) {
throw new Error(response.message ?? `Error code ${response.code}`);
}
View on GitHub (pinned to bed535e087)
Solutions
- Define BILIBILI_COOKIE_{uid} (matching the uid in the URL) with the full logged-in bilibili.com Cookie, then restart the RSSHub process.
- Confirm the variable reaches the process — check `config.bilibili.cookies` keys in a debug endpoint or `env | grep BILIBILI_COOKIE_` in the container shell.
- Make sure the uid token in the URL is the same string used as the env var suffix (string equality, not numeric — leading zeros would diverge).
Example fix
// before: request /bilibili/message/reply/2267573 with no env -> ConfigNotFoundError // after: set env then restart // BILIBILI_COOKIE_2267573=SESSDATA=...; bili_jct=...; DedeUserID=2267573; ...
Defensive patterns
Strategy: validation
Validate before calling
import { config } from '@/config';
function requireBilibiliCookieForUid(uid: string) {
if (config.bilibili.cookies[uid] === undefined) {
throw new Error(`Set BILIBILI_COOKIE_${uid} before subscribing to /bilibili/message/reply/${uid}`);
}
}
requireBilibiliCookieForUid('2267573'); Type guard
function isConfigNotFoundError(e: unknown): e is Error {
return e instanceof Error && e.name === 'ConfigNotFoundError';
} Try / catch
try {
await replyHandler(ctx);
} catch (e) {
if (e instanceof Error && e.name === 'ConfigNotFoundError') {
ctx.status = 503;
ctx.body = { error: 'Missing BILIBILI_COOKIE_' + uid };
return;
}
throw e;
} Prevention
- Provision BILIBILI_COOKIE_{uid} for every uid you plan to serve before subscribing any reader.
- Validate cookie presence at startup with a self-check route.
- Treat the env-var suffix as a string identical to the URL uid token.
When it happens
Trigger: Requesting /bilibili/message/reply/:uid with no BILIBILI_COOKIE_{uid} env var defined for that exact uid on the RSSHub host.
Common situations: Cookie env var not provisioned on a fresh deploy; uid in the feed URL is a different account than the one configured; env var misnamed (e.g. BILIBILI_COOKIE without _{uid}, or uid zero-padded differently).
Related errors
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/f86d16728cc37b23.
Report an issue: GitHub.