jackwener/OpenCLI · error · CommandExecutionError
Ctrip round-trip flight page did not render flight cards (st
Error message
Ctrip round-trip flight page did not render flight cards (state=${String(waitResult)}) What it means
A CommandExecutionError thrown when the in-page wait script returns something other than 'content' or 'captcha' — i.e. the round-trip flight list page finished waiting without rendering flight cards and without showing a captcha. The message embeds the raw wait state (e.g. 'timeout') so you can tell which wait condition failed.
Source
Thrown at clis/ctrip/flight-round.js:87
throw new ArgumentError(`--from and --to must differ (got ${fromCode})`);
}
const depart = parseIsoDate('depart', kwargs.depart);
const ret = parseIsoDate('return', kwargs.return);
if (ret < depart) {
throw new ArgumentError(`--return (${ret}) must be on or after --depart (${depart})`);
}
const limit = parseListLimit(kwargs.limit);
const searchUrl =
`https://flights.ctrip.com/online/list/round-${fromCode.toLowerCase()}-${toCode.toLowerCase()}` +
`?depdate=${depart}_${ret}&cabin=Y_S_C_F&adult=1&child=0&infant=0`;
await page.goto(searchUrl);
const waitResult = await page.evaluate(WAIT_FOR_FLIGHTS_ROUND_JS);
if (waitResult === 'captcha') {
throw new AuthRequiredError('flights.ctrip.com', 'Ctrip is asking for a captcha; complete it in your browser session and retry');
}
if (waitResult !== 'content') {
throw new CommandExecutionError(`Ctrip round-trip flight page did not render flight cards (state=${String(waitResult)})`);
}
const renderedCardCount = await page.evaluate(buildScrollUntilJs(ROUND_CARD_SELECTOR, limit));
const raw = await page.evaluate(buildFlightExtractJs(ROUND_CARD_SELECTOR, false));
if (!Array.isArray(raw)) {
throw new CommandExecutionError('Ctrip round-trip flight DOM extraction returned malformed rows');
}
if (raw.length === 0) {
if (Number(renderedCardCount) > 0) {
throw new CommandExecutionError('Ctrip round-trip flight cards rendered but parser did not find required flight anchors');
}
throw new EmptyResultError('ctrip flight-round', `No round-trip flights for ${fromCode}→${toCode} on ${depart} / ${ret}`);
}
const completeRows = raw
.filter((r) => r.departureTime && r.departureAirport && r.arrivalTime && r.arrivalAirport && r.airline)
.slice(0, limit)
.map((r, i) => ({
rank: i + 1,
airline: r.airline,View on GitHub (pinned to 49907e53dc)
Solutions
- Retry once — transient slowness often resolves on a second run.
- Use --timeout / OPENCLI_BROWSER_COMMAND_TIMEOUT to give the page longer to render.
- Open the search URL in a normal browser to see what actually renders (error page? redesign?).
- If the page renders but the CLI never finds cards, the card selector likely drifted — report a parser breakage.
Example fix
// before
cli(['flight-round', '--from','PEK','--to','SHA','--depart',d,'--return',r]);
// after
runWithRetry(() => cli(['flight-round', '--from','PEK','--to','SHA','--depart',d,'--return',r]), { retries: 2, delayMs: 8000 }); Defensive patterns
Strategy: retry
Type guard
function isRenderFailure(e) { return e && String(e.message || '').includes('did not render flight cards'); } Try / catch
try { return await runFlightRound(args); }
catch (e) {
if (isRenderFailure(e)) { await sleep(10000); return await runFlightRound(args); }
throw e;
} Prevention
- Retry with backoff; render timeouts are often transient.
- Increase --timeout or OPENCLI_BROWSER_COMMAND_TIMEOUT on slow networks.
- Spot-check the search URL manually when failures persist.
- Keep the library updated for Ctrip UI/selector changes.
When it happens
Trigger: WAIT_FOR_FLIGHTS_ROUND_JS times out or otherwise fails while waiting for the round-trip flight card selector after page.goto(searchUrl), so waitResult is neither 'captcha' nor 'content'.
Common situations: Slow network or heavily loaded Ctrip servers delaying render; Ctrip UI redesign moving/changing the flight card selector; page redirected to an error or risk-control page; regional unavailability of the route page.
Related errors
- Ctrip place page did not render attraction links for city id
- Ctrip bus page did not render schedule rows (state=${String(
- Ctrip cruise page did not render (state=${String(indexWait)}
- Ctrip cruise port page did not render (state=${String(portWa
- Ctrip package page did not render package cards (state=${Str
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d5505a9cf602e5cb.
Report an issue: GitHub.