jackwener/OpenCLI · error · CommandExecutionError

Trip.com car listing did not render (state=${String(waitResu

Error message

Trip.com car listing did not render (state=${String(waitResult)}); check the carhire city id

What it means

The `trip car` command throws this CommandExecutionError when the in-page wait script returned a state that is neither 'content', 'empty', nor 'captcha' — the carhire listing never reached a recognized render state, so car cards were not confirmed. The unrecognized state is embedded in the message, and the message hints that an invalid carhire city id is a frequent cause.

Source

Thrown at clis/trip/car.js:55

        'seats',
        'price', 'currency',
        'url',
    ],
    func: async (page, kwargs) => {
        const cityId = parseCityId('city', kwargs.city);
        const limit = parseListLimit(kwargs.limit);

        const listUrl = buildCarListUrl(cityId);
        await page.goto(listUrl);
        const waitResult = await page.evaluate(WAIT_FOR_CARS_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 === 'empty') {
            throw new EmptyResultError('trip car', `No car rentals for city id ${cityId}`);
        }
        if (waitResult !== 'content') {
            throw new CommandExecutionError(`Trip.com car listing did not render (state=${String(waitResult)}); check the carhire city id`);
        }
        const raw = await page.evaluate(buildCarExtractJs());
        if (!Array.isArray(raw)) {
            throw new CommandExecutionError('Trip.com car DOM extraction returned malformed rows');
        }
        if (raw.length === 0) {
            throw new CommandExecutionError('Trip.com car cards rendered but parser did not find required price anchors');
        }
        return raw.slice(0, limit).map((r, i) => ({
            rank: i + 1,
            category: r.category,
            vehicle: r.vehicle,
            seats: r.seats,
            price: r.price,
            currency: r.currency,
            url: listUrl,
        }));
    },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. First re-check the carhire city id — an invalid id commonly leaves the page in a perpetual loading state.
  2. Retry once, as slow renders/timeouts are often transient.
  3. Increase the browser wait timeout in the shared page setup and rerun.
  4. Open the carhire URL interactively; if the layout changed, the library's WAIT_FOR_CARS_JS needs a selector update.

Example fix

// before
await runCli(['trip', 'car', '--city-id', cityId]);
// after: validate id and retry on render failure
if (!/^\d+$/.test(cityId)) throw new Error(`suspect carhire city id: ${cityId}`);
try {
  await runCli(['trip', 'car', '--city-id', cityId]);
} catch (e) {
  if (/car listing did not render/.test(e.message)) {
    await sleep(3000);
    return runCli(['trip', 'car', '--city-id', cityId]);
  }
  throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

if (typeof cityId !== 'string' || !/^\d{1,10}$/.test(cityId)) {
  throw new Error(`carhire city id must be numeric, got: ${cityId}`);
}

Type guard

null

Try / catch

async function getCarList(cityId, attempts = 2) {
  for (let i = 0; i < attempts; i++) {
    try {
      return await runCli(['trip', 'car', '--city-id', cityId]);
    } catch (e) {
      if (/car listing did not render \(state=/.test(e.message) && i < attempts - 1) {
        await sleep(3000);
        continue;
      }
      throw e;
    }
  }
}

Prevention

When it happens

Trigger: page.evaluate(WAIT_FOR_CARS_JS) returns something other than 'content'/'empty'/'captcha' after loading buildCarListUrl(cityId) — e.g. the wait timed out on a page that never rendered because the city id is invalid, or Trip.com's SPA stalled mid-hydration.

Common situations: Wrong-format carhire city id producing a page that never finishes loading; slow network exceeding the wait deadline; Trip.com layout changes so the wait selector never matches; transient server-side errors returning a loading shell indefinitely.

Related errors


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