{"record":{"id":"f1be519e3b42a170","repo":"jackwener/OpenCLI","slug":"waiting-for-twitter-x-auth-cookies","errorCode":null,"errorMessage":"Waiting for Twitter/X auth cookies","messagePattern":"Waiting for Twitter/X auth cookies","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/twitter/auth.js","lineNumber":79,"sourceCode":"  const username = phase === 'poll'\n    ? await readScreenName(page)\n    : await readSettledScreenName(page);\n  if (!username) {\n    throw new AuthRequiredError('x.com', 'Could not detect the logged-in Twitter/X profile link');\n  }\n  return { username, url: `https://x.com/${username}` };\n}\n\nregisterSiteAuthCommands({\n  site: 'twitter',\n  domain: 'x.com',\n  loginUrl: 'https://x.com/i/flow/login',\n  columns: ['username', 'url'],\n  quickCheck: hasTwitterSessionCookies,\n  verify: verifyTwitterIdentity,\n  poll: async (page, options) => {\n    if (!await hasTwitterSessionCookies(page)) {\n      throw new AuthRequiredError('x.com', 'Waiting for Twitter/X auth cookies');\n    }\n    return verifyTwitterIdentity(page, options);\n  },\n});\n","sourceCodeStart":61,"sourceCodeEnd":84,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/auth.js#L61-L84","documentation":"The twitter site's poll handler checks session cookies before each verification while the user is completing login; if cookies are not yet present it throws AuthRequiredError('x.com', 'Waiting for Twitter/X auth cookies'). This is an expected, transient signal during the interactive login wait loop telling the caller the user hasn't finished logging in yet.","triggerScenarios":"The auth login poll for x.com runs while the user has not yet submitted credentials/confirmed login in the browser, so hasTwitterSessionCookies still returns false.","commonSituations":"User is slow to type credentials or solve 2FA/captcha during login; a headless run where no one is completing the login; wrong login URL opened; user logged into a different browser profile than the one polled.","solutions":["Complete the x.com login in the opened browser window (including 2FA).","Keep the polling command running until cookies appear instead of aborting on the first poll.","If headless/automated, supply a persisted profile that already has a valid x.com session.","Confirm the login page (https://x.com/i/flow/login) actually loaded for the user."],"exampleFix":"// before\nawait cli.run('auth login x.com', { timeout: 5000 });\n// after\nawait cli.run('auth login x.com', { timeout: 120000 }); // allow time for manual login + 2FA","handlingStrategy":"retry","validationCode":"const cookies = await getCookies('x.com');\nif (!cookies.some((c) => c.name === 'auth_token')) {\n  console.log('Waiting for you to complete x.com login...');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await auth.waitForLogin('twitter', { timeout: 120000 });\n} catch (e) {\n  if (/Waiting for Twitter\\/X auth cookies/.test(e.message)) {\n    // keep polling — user still completing login/2FA\n    return auth.waitForLogin('twitter', { timeout: 120000 });\n  }\n  throw e;\n}","preventionTips":["Use a generous timeout when a human must complete login + 2FA","Never run interactive login flows headless with no user present","Confirm the login URL opened in the visible browser window","Poll cookie presence yourself and only proceed when set"],"tags":["authentication","polling","login-flow"],"backgroundTag":"login-not-completed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}