jackwener/OpenCLI · error · CommandExecutionError

Ctrip cruise page did not render (state=${String(indexWait)}

Error message

Ctrip cruise page did not render (state=${String(indexWait)})

What it means

The cruise index page is valid only when WAIT_FOR_CRUISE_JS returns 'content'. Any other non-captcha state means the page never rendered as expected, so the CLI throws CommandExecutionError with the state value embedded for diagnosis.

Source

Thrown at clis/ctrip/cruise.js:55

    columns: [
        'rank',
        'title', 'star',
        'boarding', 'sailingDate',
        'tags', 'price',
        'url',
    ],
    func: async (page, kwargs) => {
        const port = parsePlaceName('port', kwargs.port);
        const limit = parseListLimit(kwargs.limit);

        const indexUrl = buildCruiseSearchUrl(PORT_INDEX_CODE);
        await page.goto(indexUrl);
        const indexWait = await page.evaluate(WAIT_FOR_CRUISE_JS);
        if (indexWait === 'captcha') {
            throw new AuthRequiredError('cruise.ctrip.com', 'Ctrip is asking for a captcha; complete it in your browser session and retry');
        }
        if (indexWait !== 'content') {
            throw new CommandExecutionError(`Ctrip cruise page did not render (state=${String(indexWait)})`);
        }
        const portCode = await page.evaluate(buildCruisePortLookupJs(port));
        if (!portCode) {
            throw new EmptyResultError('ctrip cruise', `No cruise departure port matching "${port}" (try a listed sea-cruise port like 上海 / 威尼斯 / 罗马)`);
        }

        let searchUrl = indexUrl;
        if (portCode !== PORT_INDEX_CODE) {
            searchUrl = buildCruiseSearchUrl(portCode);
            await page.goto(searchUrl);
            const portWait = await page.evaluate(WAIT_FOR_CRUISE_JS);
            if (portWait === 'captcha') {
                throw new AuthRequiredError('cruise.ctrip.com', 'Ctrip is asking for a captcha; complete it in your browser session and retry');
            }
            if (portWait === 'empty') {
                throw new EmptyResultError('ctrip cruise', `No cruises currently departing "${port}"`);
            }
            if (portWait !== 'content') {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command — transient network slowness is a common cause
  2. Inspect the `state=` value and align WAIT_FOR_CRUISE_JS states/selectors with the live page
  3. Extend the wait timeout in WAIT_FOR_CRUISE_JS
  4. Check whether cruise.ctrip.com redirects in your region and handle that URL

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  cruises = await ctripCruiseList({ port });
} catch (e) {
  if (e instanceof CommandExecutionError && e.message.includes('did not render')) {
    const state = /state=(\S+)/.exec(e.message)?.[1];
    console.error(`Cruise page wait failed (state=${state}); retrying`);
    await sleep(3000);
    cruises = await ctripCruiseList({ port });
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: `clis ctrip cruise` where page.evaluate(WAIT_FOR_CRUISE_JS) returns an unrecognized state (timeout, error variant, redirect target) on the cruise index URL.

Common situations: Slow network hitting the wait timeout; cruise.ctrip.com layout change so wait selectors no longer match; regional redirect to a different domain/variant; server-side error page.

Related errors


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