jackwener/OpenCLI · error · TimeoutError

${config.site} login

Error message

${config.site} login

What it means

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.

Source

Thrown at clis/_shared/site-auth.js:111

      }

      await page.goto(config.loginUrl);
      const timeoutSeconds = Number(kwargs.timeout ?? DEFAULT_TIMEOUT_SECONDS);
      const deadline = Date.now() + timeoutSeconds * 1000;
      let lastAuthMessage = '';

      while (Date.now() < deadline) {
        await page.wait(Math.min(POLL_INTERVAL_MS / 1000, Math.max(0.2, (deadline - Date.now()) / 1000)));
        try {
          const identity = await tryProbe(config, page, 'poll');
          return { status: 'login_complete', ...identity };
        } catch (error) {
          if (!isAuthRequired(error)) throw error;
          lastAuthMessage = getErrorMessage(error);
        }
      }

      throw new TimeoutError(
        `${config.site} login`,
        timeoutSeconds,
        lastAuthMessage ? `${authHint(config)} Last auth check: ${lastAuthMessage}` : authHint(config),
      );
    },
  });
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run login with a larger --timeout, e.g. opencli <site> login --timeout 600, and complete login in the opened browser window.
  2. Complete the full login flow (including 2FA/captcha/email verification) before the window's deadline.
  3. Verify you can log in manually in a normal browser — the site flow itself may have changed.
  4. If headless, switch to foreground mode so the login page is visible and interactive.

Example fix

// before
opencli example login            # times out during 2FA
// after
opencli example login --timeout 600
Defensive patterns

Strategy: try-catch

Validate before calling

// check login state before starting the interactive flow
const who = await runCommand([site, 'whoami']);
if (!who.logged_in) console.log('Complete login in the opened browser window');

Try / catch

try {
  await runCommand([site, 'login', '--timeout', '600']);
} catch (e) {
  if (e instanceof TimeoutError && e.operation === `${site} login`) {
    console.error('Login not completed in time; rerun with a larger --timeout');
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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