DIYgod/RSSHub · error · ConfigNotFoundError
Invalid cookie
Error message
Invalid cookie
What it means
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).
Source
Thrown at lib/routes/instagram/web-api/index.ts:64
}
let cookieJar: any = await cache.get('instagram:cookieJar');
// const wwwClaimV2 = await cache.get('instagram:wwwClaimV2');
const cacheMiss = !cookieJar;
if (cacheMiss) {
cookieJar = new CookieJar();
if (cookie) {
for await (const c of cookie.split('; ')) {
await cookieJar.setCookie(c, COOKIE_URL);
}
}
} else {
cookieJar = CookieJar.fromJSON(cookieJar);
}
if (/* !wwwClaimV2 &&*/ cookie && !(await checkLogin(cookieJar))) {
throw new ConfigNotFoundError('Invalid cookie');
}
let feedTitle, feedLink, feedDescription, feedLogo;
let items;
switch (category) {
case 'user': {
const userInfo = await getUserInfo(key, cookieJar);
// User feed metadata
const biography = userInfo.biography;
const fullName = userInfo.full_name;
const id = userInfo.id;
const username = userInfo.username;
feedTitle = `${fullName} (@${username}) - Instagram`;
feedDescription = biography;
// exists in web api ?? exist in private api ?? exist in both
feedLogo = userInfo.profile_pic_url_hd ?? userInfo.hd_profile_pic_url_info?.url ?? userInfo.profile_pic_url;
feedLink = `${baseUrl}/${username}`;View on GitHub (pinned to bed535e087)
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.
Example fix
// before: stale cookie in .env -> checkLogin fails // after: re-export cookie string from a logged-in browser session, then INSTAGRAM_COOKIE=csrftoken=...; sessionid=...; ds_user_id=...; ...
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: probe login before building the feed
const ok = await checkLogin(cookieJar);
if (!ok) {
throw new ConfigNotFoundError('Instagram cookie is invalid or expired — refresh INSTAGRAM_COOKIE');
} Type guard
const isOkStatus = (r: unknown): r is { status: 'ok' } =>
typeof r === 'object' && r !== null && (r as any).status === 'ok'; Try / catch
try { if (!(await checkLogin(cookieJar))) throw new ConfigNotFoundError('Invalid cookie'); }
catch (e) { /* re-classify network errors as config errors with remediation hint */ throw new ConfigNotFoundError('Instagram cookie check failed: ' + (e as Error).message); } Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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).
Related errors
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
- 对应 loginUid 的 Bilibili 用户的 Cookie 已过期
- 缺少对应论坛的cookie.
- Instagram RSS is disabled due to the lack of <a href="https:
- Instagram RSS is disabled due to the lack of <a href="https:
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/0ee7a211b5d8b0ae.
Report an issue: GitHub.