{"record":{"id":"47b5f05ecf869e47","repo":"jackwener/OpenCLI","slug":"waiting-for-instagram-sessionid-cookie","errorCode":null,"errorMessage":"Waiting for Instagram sessionid cookie","messagePattern":"Waiting for Instagram sessionid cookie","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/instagram/auth.js","lineNumber":53,"sourceCode":"    }\n  })()`);\n  if (result?.kind === 'auth') throw new AuthRequiredError('www.instagram.com', result.detail);\n  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from Instagram /users/info`);\n  if (result?.kind === 'exception') throw new CommandExecutionError(`Instagram whoami failed: ${result.detail}`);\n  if (!result?.ok) throw new CommandExecutionError(`Unexpected Instagram probe: ${JSON.stringify(result)}`);\n  return { user_id: result.user_id, username: result.username, full_name: result.full_name };\n}\n\nregisterSiteAuthCommands({\n  site: 'instagram',\n  domain: 'instagram.com',\n  loginUrl: 'https://www.instagram.com/accounts/login/',\n  columns: ['user_id', 'username', 'full_name'],\n  quickCheck: hasInstagramSessionCookie,\n  verify: verifyInstagramIdentity,\n  poll: async (page) => {\n    if (!await hasInstagramSessionCookie(page)) {\n      throw new AuthRequiredError('www.instagram.com', 'Waiting for Instagram sessionid cookie');\n    }\n    return verifyInstagramIdentity(page);\n  },\n});\n","sourceCodeStart":35,"sourceCodeEnd":58,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/auth.js#L35-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Complete the login in the opened browser window — enter username/password and any 2FA code","If stuck at a checkpoint (email/SMS code, 'was this you' prompt), resolve it in the browser","Don't close the browser window until login finishes and the CLI reports success","If it keeps polling after successful login, retry the login command — the cookie may not be visible to the automation profile"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"// during the interactive login flow, poll until the cookie appears\nwhile (!done) {\n  try {\n    return await pollLogin();\n  } catch (e) {\n    if (e.message.includes('Waiting for Instagram sessionid cookie')) {\n      await sleep(2000); // user still completing login — keep waiting\n      continue;\n    }\n    throw e;\n  }\n}","preventionTips":["Complete all login steps (credentials + 2FA + checkpoints) in the opened browser","Don't close the login tab until the CLI confirms success","If the poll never completes after login, restart the login command so a fresh cookie lands in the profile","Ensure the automation browser uses the same profile you logged into"],"tags":["authentication","login-flow","instagram","polling"],"backgroundTag":"instagram-login-pending","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}