jackwener/OpenCLI · error · CommandExecutionError

Booking.com page returned no extractable data

Error message

Booking.com page returned no extractable data

What it means

This CommandExecutionError is thrown when page.evaluate(EXTRACTOR) returned a value that is not a usable object (null, undefined, or a non-object). It means the extractor ran but produced nothing the command can process. It is a distinct failure from extraction throwing: the script completed but its result was empty or of the wrong shape.

Source

Thrown at clis/booking/search.js:281

    // Booking lazy-loads price cells; wait for at least the first card price to settle.
    try {
      await page.wait('selector', '[data-testid=property-card]', { timeoutMs: 20000 });
    } catch (_) {
      // selector wait is best-effort — extractor handles empty case explicitly
    }

    let raw;
    try {
      raw = await page.evaluate(EXTRACTOR);
    } catch (err) {
      throw new CommandExecutionError(`Failed to extract Booking.com cards: ${err?.message || err}`);
    }

    if (raw && typeof raw === 'object' && raw.data && raw.session) {
      raw = raw.data;
    }
    if (!raw || typeof raw !== 'object') {
      throw new CommandExecutionError('Booking.com page returned no extractable data');
    }
    if (raw.blocked) {
      throw new CommandExecutionError('Booking.com served a verification / captcha page; retry later or change profile');
    }

    if (raw.ok !== true) {
      throw new CommandExecutionError('Booking.com extractor returned an invalid status');
    }
    if (!Array.isArray(raw.items)) {
      throw new CommandExecutionError('Booking.com extractor returned malformed items');
    }

    const items = raw.items;
    if (items.length === 0) {
      const totalText = String(raw.totalText || '').trim();
      if (hasPositiveResultCount(totalText)) {
        throw new CommandExecutionError(
          `Booking.com page declared results but no property cards were parsed: ${totalText}`,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a different destination/dates or later — the page may have rendered no content.
  2. Load the search URL in a normal browser to confirm results actually render.
  3. Change browser profile / user agent if the site is serving bot-detection shells.
  4. Update the library if Booking.com changed its page structure.
  5. Add logging of the raw return value to see exactly what the extractor produced.

Example fix

// before
const raw = await page.evaluate(EXTRACTOR);
if (!raw || typeof raw !== 'object') throw new Error('no data');
// after
const raw = await page.evaluate(EXTRACTOR);
console.error('extractor returned:', raw); // diagnose before failing
if (!raw || typeof raw !== 'object') throw new Error('no data');
Defensive patterns

Strategy: fallback

Validate before calling

// validate inputs are likely to produce a rendered results page
if (!destination || String(destination).trim().length < 2) throw new Error('destination too short to yield results');

Try / catch

try {
  return await booking.search(params);
} catch (e) {
  if (/no extractable data/.test(e.message)) {
    return fallbackSearchProvider(params); // alternate scraper or API
  }
  throw e;
}

Prevention

When it happens

Trigger: The extractor returned null/undefined or a primitive — e.g. the selector found no nodes and the extractor short-circuited, or an enveloped result {data, session} unwrapped to nothing.

Common situations: Booking.com served an empty or skeleton shell page (no results markup) so the extractor bailed; a soft bot-block page with HTTP 200 returned no data; an intermediate/redirect page was captured instead of results; extractor version mismatch after a site update.

Related errors


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