jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Instagram sessionid cookie

Error message

Waiting for Instagram sessionid cookie

What it means

An AuthRequiredError thrown by the instagram site-auth `poll` hook while it is waiting for the user to finish logging in: the sessionid cookie has not appeared yet, so verification cannot proceed. During an interactive login flow the poller repeatedly calls this; the error signals 'keep waiting' rather than a hard failure. Once the cookie exists, poll delegates to verifyInstagramIdentity.

Source

Thrown at clis/instagram/auth.js:53

    }
  })()`);
  if (result?.kind === 'auth') throw new AuthRequiredError('www.instagram.com', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from Instagram /users/info`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`Instagram whoami failed: ${result.detail}`);
  if (!result?.ok) throw new CommandExecutionError(`Unexpected Instagram probe: ${JSON.stringify(result)}`);
  return { user_id: result.user_id, username: result.username, full_name: result.full_name };
}

registerSiteAuthCommands({
  site: 'instagram',
  domain: 'instagram.com',
  loginUrl: 'https://www.instagram.com/accounts/login/',
  columns: ['user_id', 'username', 'full_name'],
  quickCheck: hasInstagramSessionCookie,
  verify: verifyInstagramIdentity,
  poll: async (page) => {
    if (!await hasInstagramSessionCookie(page)) {
      throw new AuthRequiredError('www.instagram.com', 'Waiting for Instagram sessionid cookie');
    }
    return verifyInstagramIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the opened browser window — enter username/password and any 2FA code
  2. If stuck at a checkpoint (email/SMS code, 'was this you' prompt), resolve it in the browser
  3. Don't close the browser window until login finishes and the CLI reports success
  4. If it keeps polling after successful login, retry the login command — the cookie may not be visible to the automation profile

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

// during the interactive login flow, poll until the cookie appears
while (!done) {
  try {
    return await pollLogin();
  } catch (e) {
    if (e.message.includes('Waiting for Instagram sessionid cookie')) {
      await sleep(2000); // user still completing login — keep waiting
      continue;
    }
    throw e;
  }
}

Prevention

When it happens

Trigger: The login poll loop invokes poll(page) and hasInstagramSessionCookie(page) finds no non-empty sessionid cookie for https://www.instagram.com — i.e. the user has not completed the login form (or 2FA) yet.

Common situations: User started `login` but hasn't submitted credentials; login stuck at 2FA/OTP challenge; user closed the login tab before finishing; login submitted but Instagram did not set the cookie yet (slow load).

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/47b5f05ecf869e47. Report an issue: GitHub.