DIYgod/RSSHub · error · ConfigNotFoundError

Invalid cookie. Please also check if your ac

Error message

Invalid cookie.
                Please also check if your account is being blocked by Instagram.

What it means

Thrown as `ConfigNotFoundError` in `getUserFeedItems` when the `GET /api/v1/feed/user/:username/username/` response URL contains `/accounts/login/` — the authenticated feed endpoint redirected to login, meaning the cookie is no longer valid for feed reads, OR the account/IP is being blocked. The message additionally prompts checking for account blocks.

Source

Thrown at lib/routes/instagram/web-api/utils.ts:105

const getUserFeedItems = (id, username, cookieJar) =>
    cache.tryGet(
        `instagram:feed:${id}`,
        async () => {
            const response = await ofetch.raw(`${baseUrl}/api/v1/feed/user/${username}/username/`, {
                // cookieJar,
                headers: {
                    cookie: (await cookieJar.getCookieString(COOKIE_URL)) as string,
                    ...((await getHeaders(cookieJar)) as unknown as Record<string, string>),
                    // 401 Unauthorized if cookie does not match with IP
                    // 'X-IG-WWW-Claim': await cache.get('instagram:wwwClaimV2'),
                },
                query: {
                    count: 30,
                },
            });
            if (response.url.includes('/accounts/login/')) {
                throw new ConfigNotFoundError(`Invalid cookie.
                Please also check if your account is being blocked by Instagram.`);
            }

            return response._data.items;
        },
        config.cache.routeExpire,
        false
    );

const getTagsFeed = (tag, cookieJar) =>
    cache.tryGet(
        `instagram:tags:${tag}`,
        async () => {
            const response = await ofetch(`${baseUrl}/api/v1/tags/web_info/`, {
                // cookieJar, cookieJar is behaving weirdly here, so we use cookie header instead
                headers: {
                    cookie: (await cookieJar.getCookieString(COOKIE_URL)) as string,
                    ...((await getHeaders(cookieJar)) as unknown as Record<string, string>),

View on GitHub (pinned to bed535e087)

Solutions

  1. Refresh the cookie and verify the account is not blocked/challenged (log in via browser).
  2. Route RSSHub egress through a residential/stable proxy (set `config.instagram.proxy` or `PROXY_URI`) so the IP matches the cookie's origin.
  3. Slow down requests / raise cache TTL (`config.cache.routeExpire`) to reduce anti-bot triggers.
  4. If persistent, the account may be shadowbanned — use a fresh account.

Example fix

// before: feed read redirected to /accounts/login/
// after: refresh cookie + pin egress IP
INSTAGRAM_COOKIE=sessionid=... (fresh)
PROXY_URI=http://user:pass@residential.proxy:port
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: confirm cookie validity on the feed endpoint's domain
if (!(await checkLogin(cookieJar))) throw new ConfigNotFoundError('Cookie invalid before feed read');

Type guard

const redirectedToLogin = (url: string) => url.includes('/accounts/login/');

Try / catch

try {
  const res = await ofetch.raw(feedUrl, { headers });
  if (redirectedToLogin(res.url)) throw new ConfigNotFoundError('Invalid cookie / possible block');
  return res._data.items;
} catch (e) { /* one retry with a fresh probe, then surface */ throw e; }

Prevention

When it happens

Trigger: Calling the user-feed endpoint after the profile call succeeded but the session is partially invalidated; Instagram rate-limits or soft-blocks the session on feed reads; the session's IP no longer matches (IG ties feed reads to IP more strictly than profile reads).

Common situations: Same cookie works for profile but not feed after IG tightens anti-bot; datacenter IP flagged by Instagram; account hit with a temporary restriction; cookie on the edge of expiry.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/020d7060aea812e3. Report an issue: GitHub.