DIYgod/RSSHub · error · ConfigNotFoundError
Medium 用户 ${user} 的 Cookie 无效或已过期
Error message
Medium 用户 ${user} 的 Cookie 无效或已过期 What it means
ConfigNotFoundError thrown by the Medium 'tag' route when getWebInlineTopicFeedQuery returns falsy despite a cookie being present. The cookie is configured but Medium's tag API rejected it as invalid/expired — same pattern as 364/366.
Source
Thrown at lib/routes/medium/tag.ts:50
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 tag = ctx.req.param('tag');
const cookie = config.medium.cookies[user];
if (cookie === undefined) {
throw new ConfigNotFoundError(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`);
}
const posts = await getWebInlineTopicFeedQuery(user, tag, 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 Tag ${tag}`,
link: `https://medium.com/?tag=${tag}`,
item: parsedArticles,
};
}
View on GitHub (pinned to bed535e087)
Solutions
- Re-login on medium.com and copy a fresh Cookie header into MEDIUM_COOKIES.
- Ensure sid and cf_obc cookies are included.
- Restart RSSHub after updating config.
- If it fails immediately again, the cookie capture was incomplete — use browser DevTools Network > Request Headers > Cookie.
Example fix
// before MEDIUM_COOKIES=johndoe=expired_sid // after MEDIUM_COOKIES=johndoe=sid%3A1%3A...fresh...
Defensive patterns
Strategy: try-catch
Try / catch
try {
const posts = await getWebInlineTopicFeedQuery(user, tag, cookie);
if (!posts) throw new ConfigNotFoundError('Medium cookie expired');
} catch (e) { throw e; } Prevention
- Refresh Medium cookies proactively before expiry.
- Alert on auth-failure errors per user.
- Capture full Cookie header (incl. sid) when copying.
When it happens
Trigger: config.medium.cookies[user] is defined, but getWebInlineTopicFeedQuery(user, tag, cookie) resolves to a falsy value. Medium's GraphQL endpoint silently signals auth failure.
Common situations: Expired session cookie; partial cookie missing sid; Medium auth flow change; account logged out remotely.
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/c5fdf556efeac8fc.
Report an issue: GitHub.