{"record":{"id":"24956dd53f171cbd","repo":"jackwener/OpenCLI","slug":"no-car-rentals-for-city-id-cityid","errorCode":null,"errorMessage":"No car rentals for city id ${cityId}","messagePattern":"No car rentals for city id (.+?)","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/trip/car.js","lineNumber":52,"sourceCode":"    columns: [\n        'rank',\n        'category', 'vehicle',\n        '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,","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trip/car.js#L34-L70","documentation":"The `trip car` command throws this EmptyResultError when the carhire listing page for the given city id rendered successfully but contained zero car-rental cards (waitResult === 'empty'). The page worked; Trip.com simply returned no car inventory for that city id. The city id is included in the message to help identify bad ids.","triggerScenarios":"Calling `trip car --city-id <id>` when the carhire page for that city id loads but contains no rental offers — most often an invalid/wrong carhire city id that still resolves to a page shell with no inventory.","commonSituations":"Using a hotel/attraction id instead of a carhire city id; a guessed or hard-coded id from an outdated list; a small city with no participating rental suppliers; stale id after Trip.com renumbered its carhire cities.","solutions":["Verify the carhire city id is a valid Trip.com carhire city id (fetch it from Trip.com's carhire city reference, not from hotels pages).","Try a nearby major city's id to confirm the command works and the issue is inventory/id-specific.","Search Trip.com carhire interactively for the city and take the id from the URL, then retry.","If the id is valid but inventory is genuinely zero, treat it as no-data rather than retrying."],"exampleFix":"// before\nawait runCli(['trip', 'car', '--city-id', guessedId]);\n// after: catch empty and fall back to a validated id\ntry {\n  await runCli(['trip', 'car', '--city-id', cityId]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') return runCli(['trip', 'car', '--city-id', nearestMajorCityId]);\n  throw e;\n}","handlingStrategy":"validation","validationCode":"// verify the id is a plausible carhire city id before calling\nfunction isValidCarhireCityId(id) {\n  return typeof id === 'string' && /^\\d{1,10}$/.test(id);\n}\nif (!isValidCarhireCityId(cityId)) throw new Error(`invalid carhire city id: ${cityId}`);","typeGuard":"function isValidCarhireCityId(id) {\n  return typeof id === 'string' && /^\\d{1,10}$/.test(id);\n}","tryCatchPattern":"try {\n  return await runCli(['trip', 'car', '--city-id', cityId]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') {\n    return []; // zero inventory for this city id\n  }\n  throw e;\n}","preventionTips":["Take city ids from Trip.com carhire URLs, not hotel/attraction pages.","Keep a validated id list for the cities you query; refresh it periodically.","Fall back to a nearby major city when a small city returns no inventory.","Treat EmptyResultError as no-data, not a bug to retry."],"tags":["empty-result","no-data","bad-parameter","trip-com"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}