{"record":{"id":"f4f4349b3cf5542c","repo":"jackwener/OpenCLI","slug":"trip-com-is-asking-for-a-verification-complete-it-f4f434","errorCode":null,"errorMessage":"Trip.com is asking for a verification; complete it in your browser session and retry","messagePattern":"Trip\\.com is asking for a verification; complete it in your browser session and retry","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/trip/flight-round.js","lineNumber":62,"sourceCode":"    ],\n    func: async (page, kwargs) => {\n        const fromCode = parseIataCode('from', kwargs.from);\n        const toCode = parseIataCode('to', kwargs.to);\n        if (fromCode === toCode) {\n            throw new ArgumentError(`--from and --to must differ (got ${fromCode})`);\n        }\n        const depart = parseIsoDate('depart', kwargs.depart);\n        const ret = parseIsoDate('return', kwargs.return);\n        if (depart >= ret) {\n            throw new ArgumentError(`--depart must be before --return (got ${depart} .. ${ret})`);\n        }\n        const limit = parseListLimit(kwargs.limit);\n\n        const searchUrl = buildFlightRoundSearchUrl(fromCode, toCode, depart, ret);\n        await page.goto(searchUrl);\n        const waitResult = await page.evaluate(WAIT_FOR_FLIGHTS_JS);\n        if (waitResult === 'captcha') {\n            throw new AuthRequiredError('trip.com', 'Trip.com is asking for a verification; complete it in your browser session and retry');\n        }\n        if (waitResult !== 'content') {\n            throw new CommandExecutionError(`Trip.com flight page did not render flight cards (state=${String(waitResult)})`);\n        }\n        const raw = await page.evaluate(buildFlightExtractJs());\n        if (!Array.isArray(raw)) {\n            const reason = raw && typeof raw === 'object' && typeof raw.error === 'string'\n                && /^malformed flight card \\d+: [a-z /]+$/.test(raw.error)\n                ? `: ${raw.error}`\n                : '';\n            throw new CommandExecutionError(`Trip.com flight DOM extraction returned malformed rows${reason}`);\n        }\n        if (raw.length === 0) {\n            throw new EmptyResultError('trip flight-round', `No round-trip flights for ${fromCode} to ${toCode} on ${depart} .. ${ret}`);\n        }\n        return raw.slice(0, limit).map((r, i) => ({\n            rank: i + 1,\n            airline: r.airline,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trip/flight-round.js#L44-L80","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// before (blind retry into the same challenge)\nawait retry(runFlightRound, 3);\n// after\ntry {\n    await runFlightRound();\n} catch (e) {\n    if (e instanceof AuthRequiredError) {\n        console.error('Solve the Trip.com challenge in the browser session, then rerun.');\n    } else { throw e; }\n}","handlingStrategy":"retry","validationCode":"// Detect challenge pages before extraction\nconst challenge = await page.evaluate(() =>\n    !!document.querySelector('iframe[src*=captcha], [class*=verify], #challenge'));\nif (challenge) console.error('Complete the Trip.com verification in your browser session before retrying');","typeGuard":"function isAuthRequired(e) {\n    return e instanceof AuthRequiredError || (e && e.name === 'AuthRequiredError');\n}","tryCatchPattern":"try {\n    await runFlightRound(args);\n} catch (e) {\n    if (isAuthRequired(e)) {\n        // pause and prompt user to solve the challenge in the browser session, then retry with backoff\n    } else { throw e; }\n}","preventionTips":["Add jitter and delays between flight searches","Use a residential IP; avoid datacenter/VPN egress","Keep the browser session cookie state fresh and warm"],"tags":["captcha","auth-required","bot-detection","trip-com"],"backgroundTag":"captcha-challenge-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}