jackwener/OpenCLI · error · CommandExecutionError
Trip.com package search returned ${groups.length} group(s) b
Error message
Trip.com package search returned ${groups.length} group(s) but none carried a parseable flight identity, route, and time What it means
This CommandExecutionError signals schema drift: Trip.com returned one or more package groups, but after filtering and mapping, no row had a parseable flightNo, from, to, departure, and arrival. The library throws rather than returning partial/garbage rows, so you know the upstream markup/API shape changed rather than the route being empty.
Source
Thrown at clis/trip/package.js:89
}
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
- Retry once — occasionally transient partial data; a fresh request may parse.
- Inspect one raw group's flightlist and update mapPackageRow to the new field names/paths.
- Check for a newer version of this CLI that already handles the updated Trip.com schema.
- File/inspect a bug report with a captured raw response if the schema change persists.
Example fix
// before (old mapPackageRow assumption) flightNo: g.flightlist[0].flightNo, // after (adapt to new nested shape found in captured response) flightNo: g.flightlist[0]?.flight?.flightNo ?? g.flightlist[0]?.flightNo,
Defensive patterns
Strategy: validation
Validate before calling
const groups = await fetchGroups();
if (Array.isArray(groups) && groups.length && !groups.some(g => Array.isArray(g.flightlist) && g.flightlist.length)) {
console.warn('Upstream schema may have changed: no flightlist in any group');
} Type guard
function isParseableRow(row) {
return Boolean(row && row.flightNo && row.from && row.to && row.departure && row.arrival);
} Try / catch
try {
const rows = await packageSearch(params);
} catch (e) {
if (/parseable flight identity/.test(e.message)) {
// capture raw response for schema debugging, escalate as a bug
}
throw e;
} Prevention
- Pin and monitor the CLI/upstream scraper version; update after Trip.com schema changes.
- Add an integration test asserting a known route yields parseable rows.
- Keep mapPackageRow defensive with optional chaining and fallbacks.
- Alert on this error in production — it indicates drift, not user error.
When it happens
Trigger: groups.length > 0 but every mapped row fails the row.flightNo && row.from && row.to && row.departure && row.arrival filter — i.e. mapPackageRow produced rows missing required fields, typically because Trip.com changed the flightlist item structure.
Common situations: Trip.com deploying a UI/API schema change; a group whose flightlist contains placeholder or partial entries; mapPackageRow expectations lagging a new field layout.
Related errors
- Trip.com train DOM extraction returned malformed rows
- Trip.com transfer DOM extraction returned malformed rows
- Failed to parse 12306 station_name.js: source string not fou
- Failed to parse 12306 station_name.js: no station records fo
- archive search returned malformed JSON: ${error?.message ||
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/03074c7abd208fbb.
Report an issue: GitHub.