jackwener/OpenCLI · error · AuthRequiredError

facebook.com

Error message

facebook.com

What it means

After extracting Marketplace inbox rows, if the page script sets authRequired: true, the command throws AuthRequiredError('facebook.com', 'Facebook Marketplace inbox requires an active signed-in Facebook session.'). The script detected a login wall on the Marketplace inbox page.

Source

Thrown at clis/facebook/marketplace-inbox.js:65

        const snippet = lines[i + 2] || '';
        const time = timeRe.test(lines[i + 3] || '') ? lines[i + 3] : '';
        const key = buyer + '|' + listing;
        if (seen.has(key)) continue;
        seen.add(key);
        const nearby = lines.slice(Math.max(0, i - 2), i + 5).join(' ');
        out.push({
          buyer,
          listing,
          snippet,
          time,
          unread: /Unread/i.test(nearby),
        });
      }
      return { authRequired: false, rows: out };
    })()`);

    if (result?.authRequired) {
      throw new AuthRequiredError('facebook.com', 'Facebook Marketplace inbox requires an active signed-in Facebook session.');
    }
    const items = Array.isArray(result?.rows) ? result.rows : [];
    if (items.length === 0) {
      throw new EmptyResultError('facebook marketplace-inbox', 'No Marketplace inbox conversations were visible. Check that Marketplace inbox is available for this account.');
    }
    return items.slice(0, limit).map((item, index) => ({
      index: index + 1,
      buyer: item.buyer || '',
      listing: item.listing || '',
      snippet: item.snippet || '',
      time: item.time || '',
      unread: Boolean(item.unread),
    }));
  },
});

export const __test__ = {
  normalizeLimit,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the connected Chrome and sign in to Facebook (confirm Marketplace inbox loads manually), then retry.
  2. Complete any Facebook checkpoint/2FA prompt in the browser.
  3. Confirm the account has Marketplace inbox access (not region/age restricted).
  4. Log into the same browser profile the extension uses; don't rely on cookies from a different profile.
Defensive patterns

Strategy: try-catch

Validate before calling

// verify a signed-in session before invoking
const signedIn = await fetch('https://www.facebook.com/marketplace/inbox/', { credentials: 'include' })
  .then(r => !/login/.test(r.url)).catch(() => false);
if (!signedIn) throw new Error('Sign in to Facebook in the connected browser first');

Type guard

function isAuthRequiredError(e) { return e instanceof Error && /signed-in facebook session/i.test(e.message); }

Try / catch

try {
  const items = await cli.run(['facebook', 'marketplace-inbox']);
} catch (err) {
  if (/signed-in Facebook session/i.test(err.message)) {
    // prompt operator to log into the connected Chrome profile, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: page.evaluate returned { authRequired: true } because https://www.facebook.com/marketplace/inbox/ rendered a login/checkout interstitial instead of conversation rows.

Common situations: Facebook session cookies expired; Marketplace inbox unavailable or region-locked prompting a login gate; account logged out of the connected profile; Facebook forcing checkpoint before showing Marketplace.

Related errors


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