jackwener/OpenCLI · error · AuthRequiredError

facebook.com

Error message

facebook.com

What it means

AuthRequiredError thrown when the in-page evaluate script reports authRequired:true for facebook.com, meaning the scrape of Marketplace seller listings detected the user is not signed in. The message text ('Facebook Marketplace seller listings require an active signed-in Facebook session.') instructs the user to establish a session. The site slug 'facebook.com' identifies which site's credentials are needed.

Source

Thrown at clis/facebook/marketplace-listings.js:64

        const status = windowLines.find((line) => /^(Active|Sold|Pending|Draft)$/i.test(line)) || '';
        const listed = windowLines.find((line) => /Listed on\b/i.test(line))?.replace(/^·\s*/, '') || '';
        const clickLine = windowLines.find((line) => /clicks? on listing/i.test(line)) || '';
        const clickMatch = clickLine.match(/([\d,.]+)\s+clicks? on listing/i);
        const actions = windowLines.filter((line) => /^(Mark as sold|Mark as available|Relist this item|Share|Boost listing)$/i.test(line));
        out.push({
          title,
          price: lines[i],
          status,
          listed,
          clicks: clickMatch ? clickMatch[1] : '',
          actions,
        });
      }
      return { authRequired: false, rows: out };
    })()`);

    if (result?.authRequired) {
      throw new AuthRequiredError('facebook.com', 'Facebook Marketplace seller listings require an active signed-in Facebook session.');
    }
    const items = Array.isArray(result?.rows) ? result.rows : [];
    if (items.length === 0) {
      throw new EmptyResultError('facebook marketplace-listings', 'No seller listings were visible. Check that Marketplace selling is available for this account.');
    }
    return items.slice(0, limit).map((item, index) => ({
      index: index + 1,
      title: item.title || '',
      price: item.price || '',
      status: item.status || '',
      listed: item.listed || '',
      clicks: item.clicks || '',
      actions: Array.isArray(item.actions) ? item.actions.join(', ') : String(item.actions || ''),
    }));
  },
});

export const __test__ = {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the managed Chrome browser, sign in to Facebook, then re-run the command
  2. Confirm facebook.com/marketplace/you/selling/ renders your listings while logged in
  3. If 2FA/session verification was triggered, complete it in the browser before retrying
  4. Clear stale cookies only if login still fails, then log in again
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check login state before scraping
const loggedIn = await page.evaluate(String.raw`(() => !document.querySelector('form[action*="login"]'))()`);
if (!loggedIn) throw new Error('Not signed in to facebook.com');

Try / catch

try {
  const rows = await runMarketplaceListings();
} catch (e) {
  if (e.name === 'AuthRequiredError' && e.site === 'facebook.com') {
    await promptFacebookLogin(); // open Chrome, sign in, retry
  } else throw e;
}

Prevention

When it happens

Trigger: Running `facebook marketplace-listings` while the Chrome profile has no valid facebook.com login; Facebook redirected to login or served logged-out HTML so the parsed rows carry authRequired:true.

Common situations: Expired Facebook session cookies; logged out of the profile browser; using a fresh/incognito-like profile; Facebook invalidated the session after a password change or security prompt.

Related errors


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