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 Trip.com's anti-bot layer intercepts the airport-transfer page and the wait probe reports 'captcha'. The library cannot proceed programmatically; Trip.com wants human verification tied to your browser session.

Source

Thrown at clis/trip/transfer.js:53

        { name: 'limit', type: 'int', default: 20, help: 'Number of vehicles (1-50)' },
    ],
    columns: [
        'rank',
        'type',
        'passengers', 'luggage',
        'price', 'currency',
        'url',
    ],
    func: async (page, kwargs) => {
        const city = parseKeyword('city', kwargs.city);
        const airport = parseIataCode('airport', kwargs.airport);
        const limit = parseListLimit(kwargs.limit);

        const listUrl = buildTransferListUrl(city, airport);
        await page.goto(listUrl);
        const waitResult = await page.evaluate(WAIT_FOR_TRANSFERS_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 transfer', `No airport transfers for ${city} (${airport})`);
        }
        if (waitResult !== 'content') {
            throw new CommandExecutionError(`Trip.com transfer listing did not render (state=${String(waitResult)}); check the city and airport code`);
        }
        const landedPath = await page.evaluate('location.pathname');
        if (!/\/airport-transfers\/[^/]+\/airport-[^/]+/i.test(String(landedPath))) {
            throw new CommandExecutionError(`Trip.com bounced ${city} / ${airport} to the transfer landing; check the city name matches the airport IATA code`);
        }
        const raw = await page.evaluate(buildTransferExtractJs());
        if (!Array.isArray(raw)) {
            throw new CommandExecutionError('Trip.com transfer DOM extraction returned malformed rows');
        }
        if (raw.length === 0) {
            throw new CommandExecutionError('Trip.com transfer cards rendered but parser did not find required price anchors');
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the captcha manually in the browser session the library reuses, then retry
  2. Slow down: add delays between requests and reduce query volume
  3. Run from a residential IP / your normal machine instead of a datacenter
  4. Use a warmed-up, persistent browser profile with real cookies
  5. Switch to Trip.com's official API if this becomes routine

Example fix

// before
for (const ap of airports) await getTransfers(ap); // rapid loop -> captcha
// after
for (const ap of airports) {
  await getTransfers(ap);
  await sleep(3000 + Math.random() * 2000);
}
Defensive patterns

Strategy: retry

Validate before calling

// throttle before calling
let lastCall = 0;
async function throttledGetTransfers(args) {
  const wait = Math.max(0, 3000 - (Date.now() - lastCall));
  await new Promise(r => setTimeout(r, wait));
  lastCall = Date.now();
  return getTransfers(args);
}

Type guard

null

Try / catch

try {
  const rows = await getTransfers(args);
} catch (e) {
  if (e instanceof AuthRequiredError) {
    console.error('Open the shared browser session, solve the captcha, then rerun');
    process.exitCode = 2; // distinct code for auth-required
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Rapid repeated transfer queries from the same profile, running from a datacenter IP or headless browser fingerprint that Trip.com flags, or a shared browser session that already accumulated a challenge.

Common situations: Batch scripting many city/airport pairs in a loop; CI runners on cloud IPs; reusing an old browser profile with stale cookies; scraping during high-risk hours when Trip.com tightens bot checks.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/f1d501fde7184ca7. Report an issue: GitHub.