{"record":{"id":"b89b9cad7ff1443c","repo":"DIYgod/RSSHub","slug":"medium-user-cookie-b89b9c","errorCode":null,"errorMessage":"Medium 用户 ${user} 的 Cookie 无效或已过期","messagePattern":"Medium 用户 (.+?) 的 Cookie 无效或已过期","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/medium/for-you.ts","lineNumber":47,"sourceCode":"    description: `::: warning\nPersonalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.\n:::`,\n};\n\nasync function handler(ctx) {\n    const user = ctx.req.param('user');\n\n    const cookie = config.medium.cookies[user];\n    if (cookie === undefined) {\n        throw new ConfigNotFoundError(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`);\n    }\n\n    const posts = await getWebInlineRecommendedFeedQuery(user, cookie);\n    ctx.set('json', posts);\n\n    if (!posts) {\n        // login failed\n        throw new ConfigNotFoundError(`Medium 用户 ${user} 的 Cookie 无效或已过期`);\n    }\n\n    const urls = posts.items.map((data) => data.post.mediumUrl);\n\n    const parsedArticles = await Promise.all(urls.map((url) => parseArticle(ctx, url)));\n\n    return {\n        title: `${user} Medium For You`,\n        link: 'https://medium.com/',\n        item: parsedArticles,\n    };\n}\n","sourceCodeStart":29,"sourceCodeEnd":60,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/medium/for-you.ts#L29-L60","documentation":"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.","triggerScenarios":"config.medium.cookies[user] is defined, but getWebInlineRecommendedFeedQuery(user, cookie) resolves falsy. Medium's GraphQL endpoint silently signals auth failure.","commonSituations":"Expired session cookie; partial cookie copy missing the sid; Medium changed its auth flow; account logged out elsewhere.","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."],"exampleFix":"// before\nMEDIUM_COOKIES=johndoe=stale_sid\n\n// after\nMEDIUM_COOKIES=johndoe=sid%3A1%3A...fresh...","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    const posts = await getWebInlineRecommendedFeedQuery(user, cookie);\n    if (!posts) throw new ConfigNotFoundError('Cookie invalid/expired');\n} catch (e) { /* surface as a config/cookie alert */ throw e; }","preventionTips":["Refresh Medium cookies before they expire.","Alert operators on repeated auth-failure errors.","Log which user triggered the failure for faster triage."],"tags":["medium","auth","cookie","expired"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}