{"record":{"id":"c5fdf556efeac8fc","repo":"DIYgod/RSSHub","slug":"medium-user-cookie-c5fdf5","errorCode":null,"errorMessage":"Medium 用户 ${user} 的 Cookie 无效或已过期","messagePattern":"Medium 用户 (.+?) 的 Cookie 无效或已过期","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/medium/tag.ts","lineNumber":50,"sourceCode":"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.\n:::`,\n};\n\nasync function handler(ctx) {\n    const user = ctx.req.param('user');\n    const tag = ctx.req.param('tag');\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 getWebInlineTopicFeedQuery(user, tag, 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 Following Tag ${tag}`,\n        link: `https://medium.com/?tag=${tag}`,\n        item: parsedArticles,\n    };\n}\n","sourceCodeStart":32,"sourceCodeEnd":63,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/medium/tag.ts#L32-L63","documentation":"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.","triggerScenarios":"config.medium.cookies[user] is defined, but getWebInlineTopicFeedQuery(user, tag, cookie) resolves to a falsy value. Medium's GraphQL endpoint silently signals auth failure.","commonSituations":"Expired session cookie; partial cookie missing sid; Medium auth flow change; account logged out remotely.","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."],"exampleFix":"// before\nMEDIUM_COOKIES=johndoe=expired_sid\n\n// after\nMEDIUM_COOKIES=johndoe=sid%3A1%3A...fresh...","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    const posts = await getWebInlineTopicFeedQuery(user, tag, cookie);\n    if (!posts) throw new ConfigNotFoundError('Medium cookie expired');\n} catch (e) { throw e; }","preventionTips":["Refresh Medium cookies proactively before expiry.","Alert on auth-failure errors per user.","Capture full Cookie header (incl. sid) when copying."],"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"}