jackwener/OpenCLI · error · AuthRequiredError

Open Chrome and log in to Facebook before retrying.

Error message

Open Chrome and log in to Facebook before retrying.

What it means

When the extraction payload reports status === 'auth', getFacebookFeed throws AuthRequiredError for www.facebook.com with the message 'Open Chrome and log in to Facebook before retrying.' The in-page script detected a login wall/checkpoint instead of the feed, so the library demands an authenticated browser session.

Source

Thrown at clis/facebook/feed.js:372

  await loadFeedPosts(page, limit);

  let payload;
  try {
    payload = unwrapBrowserResult(await page.evaluate(buildFeedExtractScript(limit)));
  } catch (err) {
    throw new CommandExecutionError(
      `Failed to read facebook feed: ${err instanceof Error ? err.message : err}`,
      'Facebook may not have rendered or the feed markup may have changed.',
    );
  }

  if (!payload || typeof payload !== 'object' || !Array.isArray(payload.rows)) {
    throw new CommandExecutionError('facebook feed returned malformed extraction payload');
  }

  if (payload.status === 'auth') {
    throw new AuthRequiredError('www.facebook.com', 'Open Chrome and log in to Facebook before retrying.');
  }

  if (payload.rows.length > 0) {
    return payload.rows;
  }

  if (payload.status === 'empty') {
    throw new EmptyResultError('facebook feed', 'Facebook did not show any feed posts for this account.');
  }

  const diagnostics = payload.diagnostics || {};
  if (diagnostics.articleCount || diagnostics.actionMenuCount || diagnostics.fallbackActionCount || diagnostics.mainTextLength > 200) {
    throw new CommandExecutionError(
      'facebook feed page rendered but no feed rows could be extracted',
      `Diagnostics: articles=${diagnostics.articleCount || 0}, actions=${diagnostics.fallbackActionCount || 0}, mainTextLength=${diagnostics.mainTextLength || 0}.`,
    );
  }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the connected Chrome instance and log in to Facebook manually, then re-run the command.
  2. Verify the Chrome profile used by the extension has an active facebook.com session (visit facebook.com and confirm you see the feed).
  3. Clear any pending checkpoint (2FA/identity confirmation) in the browser.
  4. Re-authenticate via Facebook in the extension's profile rather than sharing cookies from another profile.
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling, verify an authenticated session exists
const authed = await fetch('https://www.facebook.com', { credentials: 'include' })
  .then(r => !/login/.test(r.url)).catch(() => false);
if (!authed) throw new Error('Log in to Facebook in the connected browser first');

Type guard

function isAuthRequiredError(e) { return e instanceof Error && /log in to facebook/i.test(e.message); }

Try / catch

try {
  const rows = await getFacebookFeed(page, { limit: 10 });
} catch (err) {
  if (/log in to Facebook/i.test(err.message)) {
    // pause and prompt the operator to log into the connected Chrome
  } else throw err;
}

Prevention

When it happens

Trigger: Facebook served a login page, session-expired interstitial, or security checkpoint that the extraction script classified as status: 'auth'.

Common situations: Facebook session cookie expired; user logged out in the connected Chrome profile; Facebook forced a re-authentication or flagged the session; running against a fresh browser profile with no cookies.

Related errors


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