{"record":{"id":"a37237368887a61e","repo":"jackwener/OpenCLI","slug":"trip-com-car-listing-did-not-render-state-strin","errorCode":null,"errorMessage":"Trip.com car listing did not render (state=${String(waitResult)}); check the carhire city id","messagePattern":"Trip\\.com car listing did not render \\(state=(.+?)\\); check the carhire city id","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trip/car.js","lineNumber":55,"sourceCode":"        'seats',\n        'price', 'currency',\n        'url',\n    ],\n    func: async (page, kwargs) => {\n        const cityId = parseCityId('city', kwargs.city);\n        const limit = parseListLimit(kwargs.limit);\n\n        const listUrl = buildCarListUrl(cityId);\n        await page.goto(listUrl);\n        const waitResult = await page.evaluate(WAIT_FOR_CARS_JS);\n        if (waitResult === 'captcha') {\n            throw new AuthRequiredError('trip.com', 'Trip.com is asking for a verification; complete it in your browser session and retry');\n        }\n        if (waitResult === 'empty') {\n            throw new EmptyResultError('trip car', `No car rentals for city id ${cityId}`);\n        }\n        if (waitResult !== 'content') {\n            throw new CommandExecutionError(`Trip.com car listing did not render (state=${String(waitResult)}); check the carhire city id`);\n        }\n        const raw = await page.evaluate(buildCarExtractJs());\n        if (!Array.isArray(raw)) {\n            throw new CommandExecutionError('Trip.com car DOM extraction returned malformed rows');\n        }\n        if (raw.length === 0) {\n            throw new CommandExecutionError('Trip.com car cards rendered but parser did not find required price anchors');\n        }\n        return raw.slice(0, limit).map((r, i) => ({\n            rank: i + 1,\n            category: r.category,\n            vehicle: r.vehicle,\n            seats: r.seats,\n            price: r.price,\n            currency: r.currency,\n            url: listUrl,\n        }));\n    },","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trip/car.js#L37-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["First re-check the carhire city id — an invalid id commonly leaves the page in a perpetual loading state.","Retry once, as slow renders/timeouts are often transient.","Increase the browser wait timeout in the shared page setup and rerun.","Open the carhire URL interactively; if the layout changed, the library's WAIT_FOR_CARS_JS needs a selector update."],"exampleFix":"// before\nawait runCli(['trip', 'car', '--city-id', cityId]);\n// after: validate id and retry on render failure\nif (!/^\\d+$/.test(cityId)) throw new Error(`suspect carhire city id: ${cityId}`);\ntry {\n  await runCli(['trip', 'car', '--city-id', cityId]);\n} catch (e) {\n  if (/car listing did not render/.test(e.message)) {\n    await sleep(3000);\n    return runCli(['trip', 'car', '--city-id', cityId]);\n  }\n  throw e;\n}","handlingStrategy":"retry","validationCode":"if (typeof cityId !== 'string' || !/^\\d{1,10}$/.test(cityId)) {\n  throw new Error(`carhire city id must be numeric, got: ${cityId}`);\n}","typeGuard":"null","tryCatchPattern":"async function getCarList(cityId, attempts = 2) {\n  for (let i = 0; i < attempts; i++) {\n    try {\n      return await runCli(['trip', 'car', '--city-id', cityId]);\n    } catch (e) {\n      if (/car listing did not render \\(state=/.test(e.message) && i < attempts - 1) {\n        await sleep(3000);\n        continue;\n      }\n      throw e;\n    }\n  }\n}","preventionTips":["Validate the carhire city id first — invalid ids leave the page in a permanent loading state.","Retry transient render-state failures with backoff before reporting.","Increase browser wait timeouts on slow networks.","Log the `state=` value to separate timeout cases from Trip.com layout changes."],"tags":["render-timeout","spa-hydration","bad-parameter","trip-com"],"backgroundTag":"page-render-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}