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 Trip.com deals page's wait probe reports state 'captcha': Trip.com served a bot-detection/verification challenge instead of the Top Deals content. The library surfaces this so the user can complete the challenge in their own authenticated browser session rather than having the automation fight it.

Source

Thrown at clis/trip/deals.js:39

    strategy: Strategy.COOKIE,
    browser: true,
    navigateBefore: false,
    args: [
        { name: 'limit', type: 'int', default: 20, help: 'Number of deals (1-50)' },
    ],
    columns: [
        'rank',
        'title', 'offer',
        'discount',
        'url',
    ],
    func: async (page, kwargs) => {
        const limit = parseListLimit(kwargs.limit);

        await page.goto(buildDealsUrl());
        const waitResult = await page.evaluate(WAIT_FOR_DEALS_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 deals page did not render deal tiles (state=${String(waitResult)})`);
        }
        const raw = await page.evaluate(buildDealsExtractJs());
        if (!Array.isArray(raw)) {
            throw new CommandExecutionError('Trip.com deals DOM extraction returned malformed rows');
        }
        // The Top Deals hub is a permanent curated page, so once the wait confirms it
        // rendered, zero parsed tiles means the tile markup drifted, not an empty hub.
        if (raw.length === 0) {
            throw new CommandExecutionError('Trip.com deals hub rendered but no promotion tiles parsed (the tile markup may have changed)');
        }
        return raw.slice(0, limit).map((r, i) => ({
            rank: i + 1,
            title: r.title,
            offer: r.offer,
            discount: r.discount,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the Trip.com browser session manually, complete the verification challenge, then rerun the command
  2. Slow down request frequency or wait before retrying so rate-limit signals decay
  3. Use a residential IP / disable VPN or datacenter proxy
  4. Refresh the session cookies in the browser session and retry

Example fix

// before (hard retry loop that keeps hitting the challenge)
for (;;) { await runTripDeals(); }
// after
try {
    await runTripDeals();
} catch (e) {
    if (e instanceof AuthRequiredError) {
        console.error('Complete the Trip.com verification in your browser session, then retry.');
    } else { throw e; }
}
Defensive patterns

Strategy: retry

Validate before calling

// Probe for a challenge before running the extract
const isChallenge = await page.evaluate(() =>
    !!document.querySelector('iframe[src*=captcha], [class*=verify], #challenge'));
if (isChallenge) console.error('Solve the Trip.com verification in your browser session first');

Type guard

function isAuthRequired(e) {
    return e instanceof AuthRequiredError || (e && e.name === 'AuthRequiredError');
}

Try / catch

try {
    await runTripDeals();
} catch (e) {
    if (isAuthRequired(e)) {
        // pause, prompt user to complete verification in browser session, then retry with backoff
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the Trip.com deals command; page.evaluate(WAIT_FOR_DEALS_JS) resolves with 'captcha' after page.goto(buildDealsUrl()), typically because Trip.com flagged the automated session.

Common situations: Running from a datacenter/VPN IP; too-frequent scraping from one session; missing or expired session cookies; new browser profile without prior Trip.com trust; Trip.com throttling during high traffic.

Related errors


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