{"record":{"id":"0ee7a211b5d8b0ae","repo":"DIYgod/RSSHub","slug":"invalid-cookie","errorCode":null,"errorMessage":"Invalid cookie","messagePattern":"Invalid cookie","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/instagram/web-api/index.ts","lineNumber":64,"sourceCode":"    }\n\n    let cookieJar: any = await cache.get('instagram:cookieJar');\n    // const wwwClaimV2 = await cache.get('instagram:wwwClaimV2');\n    const cacheMiss = !cookieJar;\n\n    if (cacheMiss) {\n        cookieJar = new CookieJar();\n        if (cookie) {\n            for await (const c of cookie.split('; ')) {\n                await cookieJar.setCookie(c, COOKIE_URL);\n            }\n        }\n    } else {\n        cookieJar = CookieJar.fromJSON(cookieJar);\n    }\n\n    if (/* !wwwClaimV2 &&*/ cookie && !(await checkLogin(cookieJar))) {\n        throw new ConfigNotFoundError('Invalid cookie');\n    }\n\n    let feedTitle, feedLink, feedDescription, feedLogo;\n    let items;\n    switch (category) {\n        case 'user': {\n            const userInfo = await getUserInfo(key, cookieJar);\n\n            // User feed metadata\n            const biography = userInfo.biography;\n            const fullName = userInfo.full_name;\n            const id = userInfo.id;\n            const username = userInfo.username;\n            feedTitle = `${fullName} (@${username}) - Instagram`;\n            feedDescription = biography;\n            // exists in web api ?? exist in private api ?? exist in both\n            feedLogo = userInfo.profile_pic_url_hd ?? userInfo.hd_profile_pic_url_info?.url ?? userInfo.profile_pic_url;\n            feedLink = `${baseUrl}/${username}`;","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/instagram/web-api/index.ts#L46-L82","documentation":"Thrown as `ConfigNotFoundError('Invalid cookie')` by the web-API handler when a cookie IS configured but `checkLogin(cookieJar)` returns false — i.e. the `POST /api/v1/web/fxcal/ig_sso_users/` probe did not return `status === 'ok'`. This means the session cookie is present syntactically but Instagram no longer treats it as authenticated (expired, logged out, challenge-required, or IP-mismatched).","triggerScenarios":"`config.instagram.cookie` is set, so the code enters the `checkLogin` branch; the probe call succeeds HTTP-wise but the JSON `status` is not `'ok'`. Common when the cookie has expired, was rotated, or Instagram requires a checkpoint/verification.","commonSituations":"Cookie older than a few weeks; account was logged out remotely; Instagram flagged the session for suspicious activity; the IP that generated the cookie differs from the RSSHub server IP (IG binds sessions to IP).","solutions":["Re-export a fresh session cookie from a browser logged into Instagram and update `INSTAGRAM_COOKIE`.","Ensure the RSSHub server's outbound IP matches (or is close to) the IP used to generate the cookie; use a residential proxy if needed.","Confirm the account is not in a checkpoint/challenge state by logging in manually in a browser first.","If using `config.instagram.proxy`, make sure the proxy is the same one used when baking the cookie."],"exampleFix":"// before: stale cookie in .env -> checkLogin fails\n// after: re-export cookie string from a logged-in browser session, then\nINSTAGRAM_COOKIE=csrftoken=...; sessionid=...; ds_user_id=...; ...","handlingStrategy":"try-catch","validationCode":"// pre-flight: probe login before building the feed\nconst ok = await checkLogin(cookieJar);\nif (!ok) {\n  throw new ConfigNotFoundError('Instagram cookie is invalid or expired — refresh INSTAGRAM_COOKIE');\n}","typeGuard":"const isOkStatus = (r: unknown): r is { status: 'ok' } =>\n    typeof r === 'object' && r !== null && (r as any).status === 'ok';","tryCatchPattern":"try { if (!(await checkLogin(cookieJar))) throw new ConfigNotFoundError('Invalid cookie'); }\ncatch (e) { /* re-classify network errors as config errors with remediation hint */ throw new ConfigNotFoundError('Instagram cookie check failed: ' + (e as Error).message); }","preventionTips":["Refresh cookies on a schedule; Instagram sessions expire.","Pin the cookie's origin IP to the RSSHub egress IP (proxy).","Log the checkLogin result so expiry is visible before feed errors."],"tags":["instagram","cookie","authentication","config-not-found"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}