jackwener/OpenCLI · error · CommandExecutionError

Trip.com deals hub rendered but no promotion tiles parsed (t

Error message

Trip.com deals hub rendered but no promotion tiles parsed (the tile markup may have changed)

What it means

CommandExecutionError thrown when the Top Deals hub rendered successfully but the extractor parsed zero promotion tiles. Because the hub is a permanent curated page that is never empty, zero rows means the tile markup drifted — the CSS selectors in buildDealsExtractJs no longer match Trip.com's current promotion-tile structure.

Source

Thrown at clis/trip/deals.js:51

    func: async (page, kwargs) => {
        const limit = parseListLimit(kwargs.limit);

        await page.goto(buildDealsUrl());
        const waitResult = await page.evaluate(WAIT_FOR_DEALS_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 deals page did not render deal tiles (state=${String(waitResult)})`);
        }
        const raw = await page.evaluate(buildDealsExtractJs());
        if (!Array.isArray(raw)) {
            throw new CommandExecutionError('Trip.com deals DOM extraction returned malformed rows');
        }
        // The Top Deals hub is a permanent curated page, so once the wait confirms it
        // rendered, zero parsed tiles means the tile markup drifted, not an empty hub.
        if (raw.length === 0) {
            throw new CommandExecutionError('Trip.com deals hub rendered but no promotion tiles parsed (the tile markup may have changed)');
        }
        return raw.slice(0, limit).map((r, i) => ({
            rank: i + 1,
            title: r.title,
            offer: r.offer,
            discount: r.discount,
            url: r.url,
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect the live Top Deals hub DOM and update the tile selectors in buildDealsExtractJs
  2. Retry later or from a different region to see if an A/B variant is the cause
  3. Update to the latest CLI version which may already track the new markup
  4. Capture and compare page HTML against the selectors the extractor expects

Example fix

// before
if (raw.length === 0) {
    throw new CommandExecutionError('Trip.com deals hub rendered but no promotion tiles parsed (the tile markup may have changed)');
}
// after (diagnose markup drift with a probe)
if (raw.length === 0) {
    const probe = await page.evaluate(() => document.querySelectorAll('.deal-tile, [data-deal-id]').length);
    throw new CommandExecutionError(
        `Trip.com deals hub rendered but no promotion tiles parsed (candidate tiles=${probe}; markup may have changed)`);
}
Defensive patterns

Strategy: validation

Validate before calling

// Sanity-check tile markup before trusting zero parses as markup drift
const candidateTiles = await page.evaluate(() =>
    document.querySelectorAll('[class*=deal], [data-deal-id], .promotion').length);
if (candidateTiles === 0) console.warn('No tile-like nodes at all — page may not be the deals hub');

Type guard

function hasParsedTiles(v) {
    return Array.isArray(v) && v.length > 0 && v.every(t => t && typeof t.title === 'string');
}

Try / catch

try {
    const deals = await runTripDeals();
} catch (e) {
    if (e instanceof CommandExecutionError && /no promotion tiles parsed/.test(e.message)) {
        // markup drift: capture page HTML snapshot and alert maintainers, don't blind-retry
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the Trip.com deals command when WAIT_FOR_DEALS_JS reports 'content' but page.evaluate(buildDealsExtractJs()) filters every tile out and returns an empty array, e.g. after Trip.com changed tile class names or DOM structure.

Common situations: Trip.com redesign of the deals hub; A/B-tested tile markup in your region; renamed data attributes used by the extractor; regional page variants that render tiles differently.

Related errors


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