jackwener/OpenCLI · error · AuthRequiredError
Trip.com is asking for a verification; complete it in your b
Error message
Trip.com is asking for a verification; complete it in your browser session and retry
What it means
AuthRequiredError thrown when the flight search page's wait probe (WAIT_FOR_FLIGHTS_JS) reports 'captcha': Trip.com intercepted the automated search with a verification challenge instead of flight results. Like the other Trip.com commands, it delegates the challenge to the user's browser session rather than solving it.
Source
Thrown at clis/trip/flight-round.js:62
],
func: async (page, kwargs) => {
const fromCode = parseIataCode('from', kwargs.from);
const toCode = parseIataCode('to', kwargs.to);
if (fromCode === toCode) {
throw new ArgumentError(`--from and --to must differ (got ${fromCode})`);
}
const depart = parseIsoDate('depart', kwargs.depart);
const ret = parseIsoDate('return', kwargs.return);
if (depart >= ret) {
throw new ArgumentError(`--depart must be before --return (got ${depart} .. ${ret})`);
}
const limit = parseListLimit(kwargs.limit);
const searchUrl = buildFlightRoundSearchUrl(fromCode, toCode, depart, ret);
await page.goto(searchUrl);
const waitResult = await page.evaluate(WAIT_FOR_FLIGHTS_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 !== 'content') {
throw new CommandExecutionError(`Trip.com flight page did not render flight cards (state=${String(waitResult)})`);
}
const raw = await page.evaluate(buildFlightExtractJs());
if (!Array.isArray(raw)) {
const reason = raw && typeof raw === 'object' && typeof raw.error === 'string'
&& /^malformed flight card \d+: [a-z /]+$/.test(raw.error)
? `: ${raw.error}`
: '';
throw new CommandExecutionError(`Trip.com flight DOM extraction returned malformed rows${reason}`);
}
if (raw.length === 0) {
throw new EmptyResultError('trip flight-round', `No round-trip flights for ${fromCode} to ${toCode} on ${depart} .. ${ret}`);
}
return raw.slice(0, limit).map((r, i) => ({
rank: i + 1,
airline: r.airline,View on GitHub (pinned to 49907e53dc)
Solutions
- Complete the verification manually in the Trip.com browser session, then rerun the command
- Reduce search frequency / add delays between searches
- Switch off VPN or use a residential IP
- Refresh or warm up the session cookies (visit Trip.com normally first)
Example fix
// before (blind retry into the same challenge)
await retry(runFlightRound, 3);
// after
try {
await runFlightRound();
} catch (e) {
if (e instanceof AuthRequiredError) {
console.error('Solve the Trip.com challenge in the browser session, then rerun.');
} else { throw e; }
} Defensive patterns
Strategy: retry
Validate before calling
// Detect challenge pages before extraction
const challenge = await page.evaluate(() =>
!!document.querySelector('iframe[src*=captcha], [class*=verify], #challenge'));
if (challenge) console.error('Complete the Trip.com verification in your browser session before retrying'); Type guard
function isAuthRequired(e) {
return e instanceof AuthRequiredError || (e && e.name === 'AuthRequiredError');
} Try / catch
try {
await runFlightRound(args);
} catch (e) {
if (isAuthRequired(e)) {
// pause and prompt user to solve the challenge in the browser session, then retry with backoff
} else { throw e; }
} Prevention
- Add jitter and delays between flight searches
- Use a residential IP; avoid datacenter/VPN egress
- Keep the browser session cookie state fresh and warm
When it happens
Trigger: Calling flight-round; after page.goto(buildFlightRoundSearchUrl(...)) and page.evaluate(WAIT_FOR_FLIGHTS_JS), the probe resolves to 'captcha' — Trip.com bot detection fired on the search request.
Common situations: Rapid repeated searches from one session; datacenter/VPN IPs; fresh browser profile with no cookies; peak-traffic periods with aggressive bot checks; searches with unusual parameter combinations.
Related errors
- Trip.com is asking for a verification; complete it in your b
- Trip.com is asking for a verification; complete it in your b
- Trip.com is asking for a verification; complete it in your b
- Trip.com is asking for a verification; complete it in your b
- Trip.com is asking for a verification; complete it in your b
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f4f4349b3cf5542c.
Report an issue: GitHub.