jackwener/OpenCLI · error · CommandExecutionError
Booking.com extractor returned an invalid status
Error message
Booking.com extractor returned an invalid status
What it means
This CommandExecutionError is thrown when the extractor's result is an object but its ok flag is not exactly true (raw.ok !== true). The library treats ok as a contract marker from the extractor script; anything else means the extractor ran but reported an abnormal/unknown status, so the result cannot be trusted.
Source
Thrown at clis/booking/search.js:288
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}`,
);
}
throw new EmptyResultError(
`booking search ${JSON.stringify(destination)}`,
totalText
? `No hotels rendered (${totalText}). Try a broader destination, different dates, or check the URL in a browser.`
: 'No hotels rendered. Try a broader destination, different dates, or check the URL in a browser.',View on GitHub (pinned to 49907e53dc)
Solutions
- Log/inspect the full raw object returned by page.evaluate to see the actual shape and any reason field.
- Retry the search — a transient in-page failure can produce ok:false.
- Update the library so EXTRACTOR matches the current Booking.com DOM.
- If you supply a custom extractor, ensure it returns {ok:true, items:[...]} on success.
- Check that the {data, session} unwrap logic matches your runtime's response envelope.
Example fix
// before
if (raw.ok !== true) throw new Error('invalid status');
// after
console.error('extractor status:', raw.ok, raw);
if (raw.ok !== true) throw new Error('invalid status: ' + JSON.stringify(raw).slice(0, 200)); Defensive patterns
Strategy: fallback
Validate before calling
// pre-check custom extractor contract if you inject one
if (typeof customExtractor === 'function') {
const probe = customExtractor.toString();
if (!/ok/.test(probe)) console.warn('extractor may not honor the {ok:true} contract');
} Try / catch
try {
return await booking.search(params);
} catch (e) {
if (/invalid status/.test(e.message)) {
console.error('extractor status payload unavailable; retrying once');
return booking.search(params);
}
throw e;
} Prevention
- Keep the library version matched to current Booking.com DOM.
- Do not patch EXTRACTOR casually; keep its {ok:true, items:[]} contract.
- Log the raw evaluate() result when debugging extraction issues.
- Treat ok:false as retryable, not fatal data corruption.
When it happens
Trigger: The in-page EXTRACTOR returned an object whose ok property is false, missing, or not the boolean true — e.g. partial failure inside the extractor, an enveloped/mismatched response shape after unwrapping {data, session}, or an extractor/script version mismatch.
Common situations: Stale cached extractor script on a page whose structure changed; a custom or patched EXTRACTOR passed by the caller; the data/session unwrap picked the wrong object; extractor caught an internal error and returned {ok:false, reason:...}.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Failed to fetch Barchart greeks for ${symbol}
- Failed to extract Booking.com cards: ${err?.message || err}
- Booking.com page returned no extractable data
- Booking.com extractor returned malformed items
- Booking.com page declared results but no property cards were
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1f8f31dd98de89fb.
Report an issue: GitHub.