jackwener/OpenCLI · info · EmptyResultError
No car rentals for city id ${cityId}
Error message
No car rentals for city id ${cityId} What it means
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.
Source
Thrown at clis/trip/car.js:52
columns: [
'rank',
'category', 'vehicle',
'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,View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before
await runCli(['trip', 'car', '--city-id', guessedId]);
// after: catch empty and fall back to a validated id
try {
await runCli(['trip', 'car', '--city-id', cityId]);
} catch (e) {
if (e.name === 'EmptyResultError') return runCli(['trip', 'car', '--city-id', nearestMajorCityId]);
throw e;
} Defensive patterns
Strategy: validation
Validate before calling
// verify the id is a plausible carhire city id before calling
function isValidCarhireCityId(id) {
return typeof id === 'string' && /^\d{1,10}$/.test(id);
}
if (!isValidCarhireCityId(cityId)) throw new Error(`invalid carhire city id: ${cityId}`); Type guard
function isValidCarhireCityId(id) {
return typeof id === 'string' && /^\d{1,10}$/.test(id);
} Try / catch
try {
return await runCli(['trip', 'car', '--city-id', cityId]);
} catch (e) {
if (e.name === 'EmptyResultError') {
return []; // zero inventory for this city id
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No attractions for "${query}"
- No timetable for ${from} to ${to} (${country})
- No airport transfers for ${city} (${airport})
- No trains found from ${fromStation.name} to ${toStation.name
- NO_DATA
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/24956dd53f171cbd.
Report an issue: GitHub.