DIYgod/RSSHub · error · ConfigNotFoundError
Medium 用户 ${user} 的 Cookie 无效或已过期
Error message
Medium 用户 ${user} 的 Cookie 无效或已过期 What it means
ConfigNotFoundError thrown when getFollowingFeedQuery returns a falsy result — meaning the Medium GraphQL following endpoint rejected the supplied cookie. The cookie exists in config but is no longer valid (expired or revoked), so Medium's API returns an empty/error response.
Source
Thrown at lib/routes/medium/following.ts:47
description: `::: warning
Personalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.
:::`,
};
async function handler(ctx) {
const user = ctx.req.param('user');
const cookie = config.medium.cookies[user];
if (cookie === undefined) {
throw new ConfigNotFoundError(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`);
}
const posts = await getFollowingFeedQuery(user, cookie);
ctx.set('json', posts);
if (!posts) {
// login failed
throw new ConfigNotFoundError(`Medium 用户 ${user} 的 Cookie 无效或已过期`);
}
const urls = posts.items.map((data) => data.post.mediumUrl);
const parsedArticles = await Promise.all(urls.map((url) => parseArticle(ctx, url)));
return {
title: `${user} Medium Following`,
link: 'https://medium.com/?feed=following',
item: parsedArticles,
};
}
View on GitHub (pinned to bed535e087)
Solutions
- Re-log into medium.com and recopy the full Cookie header value into config.
- Verify the cookie includes the 'sid' token and any 'cf_' Cloudflare cookies.
- Update MEDIUM_COOKIES and restart RSSHub.
- If it still fails, the account may be flagged — try with a fresh account/cookie.
Example fix
// before — stale cookie in config MEDIUM_COOKIES=johndoe=sid%3Aold_expired_token // after — fresh cookie from browser DevTools MEDIUM_COOKIES=johndoe=sid%3A1%3A...new...
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: hit a cheap Medium auth-check endpoint with the cookie // before calling the heavy following feed.
Try / catch
try {
const posts = await getFollowingFeedQuery(user, cookie);
if (!posts) throw new ConfigNotFoundError('Medium cookie expired — refresh it');
} catch (e) {
// alert operator to refresh MEDIUM_COOKIES
throw e;
} Prevention
- Schedule periodic cookie refreshes — Medium sessions last ~1-2 weeks.
- Monitor feed health and alert on this specific error.
- Automate cookie capture via a headless browser if operating at scale.
When it happens
Trigger: config.medium.cookies[user] is set (so 363 is skipped), but getFollowingFeedQuery(user, cookie) resolves to a falsy value. This is Medium's API signaling authentication failure without throwing — the cookie's session has lapsed.
Common situations: Cookie older than ~1–2 weeks (Medium sessions expire); user logged out of all devices invalidating the sid; cookie copied incompletely (missing sub-cookies); Medium rotated its session token format.
Related errors
- Medium 用户 ${user} 的 Cookie 无效或已过期
- Medium 用户 ${user} 的 Cookie 无效或已过期
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- 无权访问 id 为 ${catalogId} 的 List(可能是未设置 Cookie 或 Cookie 已过期)
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/91bc273f934270a7.
Report an issue: GitHub.