jackwener/OpenCLI · error · CommandExecutionError

Trip.com tour search did not return results (state=${String(

Error message

Trip.com tour search did not return results (state=${String(result.status)})

What it means

This CommandExecutionError is thrown when the tour search page finished loading but its reported state is neither 'captcha', 'empty', nor 'content' — i.e. the page landed in some unexpected state. The library can't classify it, so it surfaces the raw state value for diagnosis.

Source

Thrown at clis/trip/tour.js:65

    func: async (page, kwargs) => {
        const query = parseKeyword('query', kwargs.query);
        const tourType = parseTourType(kwargs.type);
        const limit = parseListLimit(kwargs.limit);

        const searchUrl = buildTourSearchUrl(query, tourType);
        await page.goto(searchUrl);
        const result = await page.evaluate(buildTourSearchJs(query));
        if (!result || typeof result !== 'object') {
            throw new CommandExecutionError('Trip.com tour search returned malformed data');
        }
        if (result.status === 'captcha') {
            throw new AuthRequiredError('trip.com', 'Trip.com is asking for a verification; complete it in your browser session and retry');
        }
        if (result.status === 'empty') {
            throw new EmptyResultError('trip tour', `No ${kwargs.type || 'private'} tours for "${query}"`);
        }
        if (result.status !== 'content') {
            throw new CommandExecutionError(`Trip.com tour search did not return results (state=${String(result.status)})`);
        }
        // Products captured but none carry a name is drift (schema moved), not an empty search;
        // a genuine no-match resolves as status 'empty' above off the page's "0 routes found".
        const rows = Array.isArray(result.rows) ? result.rows.filter((r) => r.name) : [];
        if (rows.length === 0) {
            throw new CommandExecutionError('Trip.com tour search captured products but none carried a name (the product markup may have changed)');
        }
        return rows.slice(0, limit).map((r, i) => ({
            rank: i + 1,
            name: r.name,
            type: r.type,
            rating: r.rating,
            reviews: r.reviews,
            price: r.price,
            currency: 'USD',
            url: r.url,
        }));
    },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry — intermediate render states often resolve with a fresh attempt.
  2. Read the state= value in the message and add handling for it in buildTourSearchJs / the status dispatch.
  3. Increase waits/timeouts before evaluating so the page settles into a known state.
  4. Open searchUrl manually to see what state the page actually ends in.

Example fix

// before
throw new CommandExecutionError(`... state=${String(result.status)}`); // unknown state not handled
// after
if (result.status === 'loading') { await page.waitForTimeout(3000); result = await page.evaluate(buildTourSearchJs(query)); }
Defensive patterns

Strategy: retry

Type guard

function isClassifiedResult(r) { return r != null && typeof r === 'object' && ['content','empty','captcha'].includes(r.status); }

Try / catch

try {
  const rows = await tourSearch(query, type);
} catch (e) {
  const m = /state=(\w+)/.exec(e.message);
  if (m) { log.warn(`unknown page state ${m[1]}; retrying`); return tourSearch(query, type); }
  throw e;
}

Prevention

When it happens

Trigger: WAIT-style extraction reporting an unknown status string — e.g. 'timeout', 'redirect', 'error', or a new state introduced by a Trip.com page change; page partially rendered when the script sampled its state.

Common situations: Network slowness leaving the page in an intermediate state; Trip.com A/B tests introducing new page states; regional redirects to consent/landing pages.

Related errors


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