jackwener/OpenCLI · error · CommandExecutionError

Ctrip tour cards rendered but parser did not find required p

Error message

Ctrip tour cards rendered but parser did not find required package anchors

What it means

A CommandExecutionError raised by `ctrip tour` when the extraction returned a well-formed but empty array: tour cards rendered in the DOM, yet the parser matched no elements against its required package anchors (.list_product_item based selectors). This signals a markup/parser mismatch rather than a load failure or genuinely empty results.

Source

Thrown at clis/ctrip/tour.js:60

        const searchUrl = buildTourListUrl(destination);
        await page.goto(searchUrl);
        const waitResult = await page.evaluate(WAIT_FOR_VACATIONS_JS);
        if (waitResult === 'captcha') {
            throw new AuthRequiredError('vacations.ctrip.com', 'Ctrip is asking for a captcha; complete it in your browser session and retry');
        }
        if (waitResult === 'empty') {
            throw new EmptyResultError('ctrip tour', `No tour packages for "${destination}"`);
        }
        if (waitResult !== 'content') {
            throw new CommandExecutionError(`Ctrip tour page did not render package cards (state=${String(waitResult)})`);
        }
        const raw = await page.evaluate(buildVacationsExtractJs());
        if (!Array.isArray(raw)) {
            throw new CommandExecutionError('Ctrip tour DOM extraction returned malformed rows');
        }
        if (raw.length === 0) {
            throw new CommandExecutionError('Ctrip tour cards rendered but parser did not find required package anchors');
        }
        return raw.slice(0, limit).map((r, i) => ({
            rank: i + 1,
            title: r.title,
            subtitle: r.subtitle,
            tags: r.tags,
            score: r.score,
            sold: r.sold,
            reviews: r.reviews,
            price: r.price,
            url: searchUrl,
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check in a browser whether .list_product_item still exists on the tour results page
  2. Update the CLI to a version whose extractor matches current markup
  3. Try a popular destination (e.g. 北京) to rule out keyword-specific templates
  4. Inspect for iframes/shadow DOM and extend the extractor accordingly
  5. Patch the selectors in buildVacationsExtractJs (clis/ctrip/utils.js) to the new classes

Example fix

// before
if (raw.length === 0) throw new CommandExecutionError('parser did not find required package anchors');
// after
if (raw.length === 0) {
  const alt = await page.evaluate(fallbackTourExtractJs()); // updated selectors
  if (!alt.length) throw new CommandExecutionError('parser did not find required package anchors');
  return alt.slice(0, limit);
}
Defensive patterns

Strategy: fallback

Try / catch

try {
  const tours = await runCli('ctrip', 'tour', dest);
} catch (e) {
  if (e.name === 'CommandExecutionError' && e.message.includes('package anchors')) {
    tours = await runCli('ctrip', 'package', dest); // alternate tab / flag selector drift
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli ctrip tour <destination>` where the page visually shows tour cards but buildVacationsExtractJs() finds no anchor elements — typically after a Ctrip class rename, an A/B markup variant, or results nested in an iframe/shadow root the extractor does not reach.

Common situations: Ctrip front-end redesign changing card class names; regional Ctrip versions with different DOM; A/B test variants; results rendered via a different template for certain destinations.

Related errors


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