jackwener/OpenCLI · info · EmptyResultError
No flight+hotel packages for ${origin.name} to ${dest.name}
Error message
No flight+hotel packages for ${origin.name} to ${dest.name} on ${depart} .. ${ret} What it means
This EmptyResultError is thrown by the Trip.com package search when the API responds successfully but returns zero flight+hotel package groups for the requested route and dates. The library distinguishes a genuine empty result set (nothing bookable) from malformed data, so hitting this means the request itself was well-formed but Trip.com had no matching packages.
Source
Thrown at clis/trip/package.js:82
}
const dest = await resolvePackageCity(to);
if (!dest) {
throw new ArgumentError(`Could not resolve destination "${to}" to a Trip.com city; run 'trip search ${to}' to find the name`);
}
if (origin.cityId === dest.cityId) {
throw new ArgumentError(`--from and --to must differ (both resolved to ${dest.name})`);
}
const groups = await fetchPackageSearch({
dcode: origin.cityCode,
acode: dest.cityCode,
hcityid: String(dest.cityId),
depart,
ret,
adults,
});
if (groups.length === 0) {
throw new EmptyResultError('trip package', `No flight+hotel packages for ${origin.name} to ${dest.name} on ${depart} .. ${ret}`);
}
const rows = groups
.filter((g) => g && Array.isArray(g.flightlist) && g.flightlist.length)
.map((g) => mapPackageRow(g, 0))
.filter((row) => row.flightNo && row.from && row.to && row.departure && row.arrival);
if (rows.length === 0) {
throw new CommandExecutionError(`Trip.com package search returned ${groups.length} group(s) but none carried a parseable flight identity, route, and time`);
}
return rows.slice(0, limit).map((row, i) => ({ ...row, rank: i + 1 }));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Try different travel dates (shift depart/ret by a day or two) — inventory is date-sensitive.
- Try a nearby or larger origin/destination city that has package coverage.
- Book flight and hotel separately via the other trip.com commands instead of a package.
- If the route should plausibly have packages, log the raw API response and verify the request params (cityId, dates, adults) are correct.
Example fix
// before
const rows = await tripPackage({ origin, dest, depart: '2026-01-01', ret: '2026-01-02' });
// after
try {
const rows = await tripPackage({ origin, dest, depart: '2026-01-05', ret: '2026-01-08' });
} catch (e) {
if (e.name === 'EmptyResultError') return []; // no packages for this route/date
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!origin?.cityId || !dest?.cityId) throw new Error('origin and dest must resolve to cityIds');
if (!depart || !ret) throw new Error('depart and ret dates are required'); Type guard
function hasCityId(c) { return c != null && typeof c.cityId !== 'undefined' && typeof c.name === 'string'; } Try / catch
try {
const rows = await packageSearch({ origin, dest, depart, ret });
} catch (e) {
if (e instanceof EmptyResultError) return [];
throw e;
} Prevention
- Prefer major city pairs with known package inventory.
- Validate dates are in the future and within a bookable window.
- Catch EmptyResultError explicitly and degrade gracefully (separate flight+hotel booking).
- Log empty routes to detect systematically uncovered markets.
When it happens
Trigger: Calling the trip package search with an origin/destination pair and depart/ret dates for which Trip.com's package inventory returns groups.length === 0 — e.g. obscure routes, far-future or past dates, or dates with sold-out inventory.
Common situations: Searching niche city pairs with no bundled flight+hotel deals; querying dates outside Trip.com's package inventory window; typo'd city resolving to a valid cityId with no package coverage; weekend/holiday inventory exhausted.
Related errors
- No attractions for "${query}"
- Trip.com attraction cards rendered but parser did not find r
- No car rentals for city id ${cityId}
- No round-trip flights for ${fromCode} to ${toCode} on ${depa
- No flights for ${fromCode} to ${toCode} on ${date}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/727f7f17ad97ac6f.
Report an issue: GitHub.