jackwener/OpenCLI · warning · 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

The `trip attraction` command loads Trip.com's things-to-do search page in a cookie-backed browser session. The in-page wait script (WAIT_FOR_ATTRACTIONS_JS) reports state 'captcha' when Trip.com shows a bot-verification / challenge instead of product content, and the command then throws AuthRequiredError telling you to complete the verification in your browser session and retry. This is an intentional hard stop: scraping cannot proceed until a human passes the check.

Source

Thrown at clis/trip/attraction.js:48

        { name: 'query', required: true, positional: true, help: 'Destination or attraction keyword (e.g. Tokyo / Paris / Louvre)' },
        { name: 'limit', type: 'int', default: 20, help: 'Number of results (1-50)' },
    ],
    columns: [
        'rank',
        'name',
        'rating', 'reviews', 'booked',
        'price', 'currency',
        'url',
    ],
    func: async (page, kwargs) => {
        const query = parseKeyword('query', kwargs.query);
        const limit = parseListLimit(kwargs.limit);

        const searchUrl = buildAttractionSearchUrl(query);
        await page.goto(searchUrl);
        const waitResult = await page.evaluate(WAIT_FOR_ATTRACTIONS_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 attraction', `No attractions for "${query}"`);
        }
        if (waitResult !== 'content') {
            throw new CommandExecutionError(`Trip.com things-to-do page did not render product cards (state=${String(waitResult)})`);
        }
        const raw = await page.evaluate(buildAttractionExtractJs());
        if (!Array.isArray(raw)) {
            throw new CommandExecutionError('Trip.com attraction DOM extraction returned malformed rows');
        }
        if (raw.length === 0) {
            throw new CommandExecutionError('Trip.com attraction cards rendered but parser did not find required detail-link anchors');
        }
        return raw.slice(0, limit).map((r, i) => ({
            rank: i + 1,
            name: r.name,
            rating: r.rating,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the same browser profile/session interactively, complete the Trip.com verification manually, then rerun the command.
  2. Refresh the stored Trip.com cookies (log in again interactively) since the CLI uses Strategy.COOKIE.
  3. Reduce request frequency / add delays between calls to avoid rate-limit challenges.
  4. Switch off VPN/proxy or use a residential IP, as datacenter IPs commonly trigger Trip.com challenges.

Example fix

// before: blind retry loop against Trip.com
for (let i = 0; i < 3; i++) { await runCli(['trip', 'attraction', query]); }
// after: catch AuthRequiredError and pause for human verification
try {
  await runCli(['trip', 'attraction', query]);
} catch (e) {
  if (e.name === 'AuthRequiredError') {
    await openBrowserForManualVerification('trip.com'); // complete check, refresh cookies
    await runCli(['trip', 'attraction', query]);
  } else throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  return await runCli(['trip', 'attraction', query]);
} catch (e) {
  if (e.name === 'AuthRequiredError') {
    // cannot self-heal: require human to complete the Trip.com check
    await promptManualVerification(e.message); // open browser session, solve challenge
    return runCli(['trip', 'attraction', query]); // single retry, no loop
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the trip attraction CLI when page.evaluate(WAIT_FOR_ATTRACTIONS_JS) resolves to 'captcha' — Trip.com returned an anti-bot challenge for the attraction search URL (buildAttractionSearchUrl(query)) instead of the things-to-do page.

Common situations: Expired or stale Trip.com cookies in the shared browser profile; too many rapid automated requests triggering rate-limit challenges; datacenter/VPN IP flagged by Trip.com; headless browser fingerprint detected; first run of a session that has never been authenticated interactively.

Related errors


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