jackwener/OpenCLI · error · CommandExecutionError
Trip.com flight page did not render flight cards (state=${St
Error message
Trip.com flight page did not render flight cards (state=${String(waitResult)}) What it means
CommandExecutionError thrown when the flight search page loaded but WAIT_FOR_FLIGHTS_JS resolved with a state that is neither 'content' nor 'captcha' (e.g. a timeout state): the flight cards never rendered, so extraction cannot proceed. The failing state is embedded in the message for diagnosis.
Source
Thrown at clis/trip/flight-round.js:65
const toCode = parseIataCode('to', kwargs.to);
if (fromCode === toCode) {
throw new ArgumentError(`--from and --to must differ (got ${fromCode})`);
}
const depart = parseIsoDate('depart', kwargs.depart);
const ret = parseIsoDate('return', kwargs.return);
if (depart >= ret) {
throw new ArgumentError(`--depart must be before --return (got ${depart} .. ${ret})`);
}
const limit = parseListLimit(kwargs.limit);
const searchUrl = buildFlightRoundSearchUrl(fromCode, toCode, depart, ret);
await page.goto(searchUrl);
const waitResult = await page.evaluate(WAIT_FOR_FLIGHTS_JS);
if (waitResult === 'captcha') {
throw new AuthRequiredError('trip.com', 'Trip.com is asking for a verification; complete it in your browser session and retry');
}
if (waitResult !== 'content') {
throw new CommandExecutionError(`Trip.com flight page did not render flight cards (state=${String(waitResult)})`);
}
const raw = await page.evaluate(buildFlightExtractJs());
if (!Array.isArray(raw)) {
const reason = raw && typeof raw === 'object' && typeof raw.error === 'string'
&& /^malformed flight card \d+: [a-z /]+$/.test(raw.error)
? `: ${raw.error}`
: '';
throw new CommandExecutionError(`Trip.com flight DOM extraction returned malformed rows${reason}`);
}
if (raw.length === 0) {
throw new EmptyResultError('trip flight-round', `No round-trip flights for ${fromCode} to ${toCode} on ${depart} .. ${ret}`);
}
return raw.slice(0, limit).map((r, i) => ({
rank: i + 1,
airline: r.airline,
departureTime: r.departureTime,
departureAirport: r.departureAirport,
arrivalTime: r.arrivalTime,View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the search — transient render timeouts commonly succeed on a second attempt
- Check the embedded state value and increase wait budget/patience if it is a timeout
- Confirm manually in the browser session that results render for the same route/dates
- If persistent, update WAIT_FOR_FLIGHTS_JS selectors to the current Trip.com card markup
Example fix
// before
const waitResult = await page.evaluate(WAIT_FOR_FLIGHTS_JS);
if (waitResult !== 'content') { throw ... }
// after
const waitResult = await page.evaluate(WAIT_FOR_FLIGHTS_JS);
if (waitResult !== 'content' && waitResult !== 'captcha') {
await page.waitForTimeout(3000);
const retryResult = await page.evaluate(WAIT_FOR_FLIGHTS_JS);
if (retryResult === 'content') { /* proceed */ }
} Defensive patterns
Strategy: retry
Validate before calling
// Check flight-card containers exist before relying on the wait result
const cards = await page.evaluate(() =>
document.querySelectorAll('[class*=flight-card], [data-flight-id]').length);
if (cards === 0) console.warn('No flight-card nodes yet; results may still be loading'); Type guard
function isWaitState(v) {
return typeof v === 'string' && ['content', 'captcha', 'timeout', 'empty'].includes(v);
} Try / catch
try {
await runFlightRound(args);
} catch (e) {
if (e instanceof CommandExecutionError && /did not render flight cards/.test(e.message)) {
// parse state from message; retry with longer budget or surface a slow-page warning
} else { throw e; }
} Prevention
- Retry render timeouts once with backoff before failing
- Budget generous wait time for long-haul multi-leg searches
- CI-check flight-card selectors against saved result-page HTML
When it happens
Trigger: Calling flight-round with valid arguments, but after goto the flight-card wait selector never matches within its budget — page.evaluate(WAIT_FOR_FLIGHTS_JS) returns e.g. 'timeout', producing (state=timeout) in the message.
Common situations: Slow page loads on complex search results; Trip.com returning an intermediate 'searching' page that never transitions; layout changes renaming flight-card containers; heavy regional variants without the expected cards.
Related errors
- Trip.com deals page did not render deal tiles (state=${Strin
- Trip.com attraction DOM extraction returned malformed rows
- Trip.com car DOM extraction returned malformed rows
- Trip.com car cards rendered but parser did not find required
- Trip.com deals DOM extraction returned malformed rows
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a6dac29b810c496f.
Report an issue: GitHub.