{"record":{"id":"34916d107ef0dbc6","repo":"jackwener/OpenCLI","slug":"trip-com-bounced-city-airport-to-the-trans","errorCode":null,"errorMessage":"Trip.com bounced ${city} / ${airport} to the transfer landing; check the city name matches the airport IATA code","messagePattern":"Trip\\.com bounced (.+?) / (.+?) to the transfer landing; check the city name matches the airport IATA code","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trip/transfer.js","lineNumber":63,"sourceCode":"        const city = parseKeyword('city', kwargs.city);\n        const airport = parseIataCode('airport', kwargs.airport);\n        const limit = parseListLimit(kwargs.limit);\n\n        const listUrl = buildTransferListUrl(city, airport);\n        await page.goto(listUrl);\n        const waitResult = await page.evaluate(WAIT_FOR_TRANSFERS_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 === 'empty') {\n            throw new EmptyResultError('trip transfer', `No airport transfers for ${city} (${airport})`);\n        }\n        if (waitResult !== 'content') {\n            throw new CommandExecutionError(`Trip.com transfer listing did not render (state=${String(waitResult)}); check the city and airport code`);\n        }\n        const landedPath = await page.evaluate('location.pathname');\n        if (!/\\/airport-transfers\\/[^/]+\\/airport-[^/]+/i.test(String(landedPath))) {\n            throw new CommandExecutionError(`Trip.com bounced ${city} / ${airport} to the transfer landing; check the city name matches the airport IATA code`);\n        }\n        const raw = await page.evaluate(buildTransferExtractJs());\n        if (!Array.isArray(raw)) {\n            throw new CommandExecutionError('Trip.com transfer DOM extraction returned malformed rows');\n        }\n        if (raw.length === 0) {\n            throw new CommandExecutionError('Trip.com transfer cards rendered but parser did not find required price anchors');\n        }\n        return raw.slice(0, limit).map((r, i) => ({\n            rank: i + 1,\n            type: r.type,\n            passengers: r.passengers,\n            luggage: r.luggage,\n            price: r.price,\n            currency: r.currency,\n            url: listUrl,\n        }));\n    },","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trip/transfer.js#L45-L81","documentation":"CommandExecutionError thrown when Trip.com redirected the transfer search back to the generic airport-transfers landing page instead of a specific airport results page. The URL path regex /\\/airport-transfers\\/[^/]+\\/airport-[^/]+/ fails, so the library concludes the city/airport combination did not resolve.","triggerScenarios":"Passing an airport IATA code that does not match the city (e.g. city 'Paris' with airport 'LHR'), a nonexistent airport code, or a city name Trip.com cannot map, causing a bounce to the landing/search page.","commonSituations":"Mismatched city–airport pairs when users copy codes from a different city; outdated airport codes; typos like 'LDN' instead of 'LON' city slugs; Trip.com changing its URL scheme so the regex no longer matches a valid result page.","solutions":["Verify the city name matches the airport IATA code you passed","Check Trip.com's URL scheme — if they redesigned paths, update the regex in the source","Test the URL manually in a browser to see where Trip.com redirects","Correct the airport code (e.g. Paris -> CDG/ORY, not LHR)"],"exampleFix":"// before\nawait getTransfers({ city: 'Paris', airport: 'LHR' }); // mismatch -> bounce\n// after\nawait getTransfers({ city: 'London', airport: 'LHR' });","handlingStrategy":"validation","validationCode":"// ensure city and airport actually correspond\nconst cityByIata = { LHR:'London', LGW:'London', CDG:'Paris', ORY:'Paris', JFK:'New York' };\nif (cityByIata[airport] && cityByIata[airport].toLowerCase() !== city.toLowerCase()) {\n  throw new Error(`airport ${airport} does not match city ${city}`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  const rows = await getTransfers(args);\n} catch (e) {\n  if (e.message.includes('bounced')) {\n    console.error(`Check: does ${airport} belong to ${city}?`);\n  }\n  throw e;\n}","preventionTips":["Map IATA codes to cities and validate pairs before calling","Watch for Trip.com URL-scheme changes affecting the path regex","Test new airport codes manually in a browser first","Use full correct city names as Trip.com slugs expect them"],"tags":["scraping","redirect","trip-com","url-validation"],"backgroundTag":"unexpected-redirect","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}