jackwener/OpenCLI · warning · EmptyResultError

facebook marketplace-listings

Error message

facebook marketplace-listings

What it means

EmptyResultError thrown when the authenticated Marketplace seller-listings scrape returned zero rows. It is raised only after authRequired was false, so the session was valid but no listing rows were parsed. This signals empty data or a markup mismatch rather than an auth or navigation problem.

Source

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

        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__ = {
  normalizeLimit,
};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm facebook.com/marketplace/you/selling/ shows listings in the logged-in browser
  2. Re-run the command to rule out slow SPA rendering
  3. Create/publish a listing if the account genuinely has none
  4. If rows exist in-browser but not via the CLI, update the evaluate script's selectors to the current Facebook markup
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify listings exist in-browser before scraping
const hasListings = await page.evaluate(String.raw`(() => document.querySelectorAll('[role="main"] a[href*="/marketplace/item/"]').length > 0)()`);

Type guard

const isNonEmptyArray = (v) => Array.isArray(v) && v.length > 0;

Try / catch

try {
  const rows = await runMarketplaceListings();
} catch (e) {
  if (/No seller listings were visible/.test(e.message)) {
    console.warn('No listings for this account; returning empty output');
  } else throw e;
}

Prevention

When it happens

Trigger: `facebook marketplace-listings` on an account with no items for sale; the selling page loaded but the row selectors matched nothing (Facebook DOM change); the page had not finished rendering seller listings when the script scraped it.

Common situations: New seller account with zero listings; all listings deleted/archived; regional account without Marketplace selling; silent Facebook markup update breaking selectors.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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