DIYgod/RSSHub · error · ConfigNotFoundError
Medium 用户 ${user} 的 Cookie 无效或已过期
Error message
Medium 用户 ${user} 的 Cookie 无效或已过期 What it means
ConfigNotFoundError thrown by the 'for-you' route when getWebInlineRecommendedFeedQuery returns falsy despite a cookie being present. The cookie is configured but Medium's recommendation API rejected it as invalid/expired — same pattern as 364.
Source
Thrown at lib/routes/medium/for-you.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 getWebInlineRecommendedFeedQuery(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 For You`,
link: 'https://medium.com/',
item: parsedArticles,
};
}
View on GitHub (pinned to bed535e087)
Solutions
- Re-authenticate on medium.com and copy the fresh Cookie header into MEDIUM_COOKIES.
- Ensure the sid and cf_obc cookies are included.
- Restart RSSHub after updating config.
- Retry with a new Medium account if the session keeps expiring immediately.
Example fix
// before MEDIUM_COOKIES=johndoe=stale_sid // after MEDIUM_COOKIES=johndoe=sid%3A1%3A...fresh...
Defensive patterns
Strategy: try-catch
Try / catch
try {
const posts = await getWebInlineRecommendedFeedQuery(user, cookie);
if (!posts) throw new ConfigNotFoundError('Cookie invalid/expired');
} catch (e) { /* surface as a config/cookie alert */ throw e; } Prevention
- Refresh Medium cookies before they expire.
- Alert operators on repeated auth-failure errors.
- Log which user triggered the failure for faster triage.
When it happens
Trigger: config.medium.cookies[user] is defined, but getWebInlineRecommendedFeedQuery(user, cookie) resolves falsy. Medium's GraphQL endpoint silently signals auth failure.
Common situations: Expired session cookie; partial cookie copy missing the sid; Medium changed its auth flow; account logged out elsewhere.
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/b89b9cad7ff1443c.
Report an issue: GitHub.