{"record":{"id":"1b5325ce8c373921","repo":"jackwener/OpenCLI","slug":"config-site-login","errorCode":null,"errorMessage":"${config.site} login","messagePattern":"\\$\\{config\\.site\\} login","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/_shared/site-auth.js","lineNumber":111,"sourceCode":"      }\n\n      await page.goto(config.loginUrl);\n      const timeoutSeconds = Number(kwargs.timeout ?? DEFAULT_TIMEOUT_SECONDS);\n      const deadline = Date.now() + timeoutSeconds * 1000;\n      let lastAuthMessage = '';\n\n      while (Date.now() < deadline) {\n        await page.wait(Math.min(POLL_INTERVAL_MS / 1000, Math.max(0.2, (deadline - Date.now()) / 1000)));\n        try {\n          const identity = await tryProbe(config, page, 'poll');\n          return { status: 'login_complete', ...identity };\n        } catch (error) {\n          if (!isAuthRequired(error)) throw error;\n          lastAuthMessage = getErrorMessage(error);\n        }\n      }\n\n      throw new TimeoutError(\n        `${config.site} login`,\n        timeoutSeconds,\n        lastAuthMessage ? `${authHint(config)} Last auth check: ${lastAuthMessage}` : authHint(config),\n      );\n    },\n  });\n}\n","sourceCodeStart":93,"sourceCodeEnd":119,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/_shared/site-auth.js#L93-L119","documentation":"registerSiteAuthCommands' login command polls the site for a logged-in identity and, if the user does not complete login within the --timeout window (default 300s), throws a TimeoutError with operation '<site> login'. The detail includes the last auth-check message plus a hint to run `opencli <site> login`. It means the interactive login was never detected as complete before the deadline.","triggerScenarios":"Running `opencli <site> login --timeout N` and not finishing the site's login flow (credentials, 2FA, captcha) within N seconds; each poll raised AuthRequiredError until the deadline expired.","commonSituations":"Slow manual login with 2FA/SMS codes exceeding the default 5 minutes; user closes the browser window before finishing; site login page changed or login requires additional steps (email verification) so verification never passes; headless window where the user never saw the login page.","solutions":["Re-run login with a larger --timeout, e.g. opencli <site> login --timeout 600, and complete login in the opened browser window.","Complete the full login flow (including 2FA/captcha/email verification) before the window's deadline.","Verify you can log in manually in a normal browser — the site flow itself may have changed.","If headless, switch to foreground mode so the login page is visible and interactive."],"exampleFix":"// before\nopencli example login            # times out during 2FA\n// after\nopencli example login --timeout 600","handlingStrategy":"try-catch","validationCode":"// check login state before starting the interactive flow\nconst who = await runCommand([site, 'whoami']);\nif (!who.logged_in) console.log('Complete login in the opened browser window');","typeGuard":null,"tryCatchPattern":"try {\n  await runCommand([site, 'login', '--timeout', '600']);\n} catch (e) {\n  if (e instanceof TimeoutError && e.operation === `${site} login`) {\n    console.error('Login not completed in time; rerun with a larger --timeout');\n  } else throw e;\n}","preventionTips":["Complete the full login flow (2FA, captcha, email verification) promptly","Pass a generous --timeout (e.g. 600) when 2FA is involved","Keep the login browser window open and in the foreground","Verify manual login works in a normal browser first"],"tags":["authentication","timeout","browser"],"backgroundTag":"login-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}