{"record":{"id":"0090940d94e65318","repo":"jackwener/OpenCLI","slug":"no-hotels-for-city-cityid-on-checkin-ch","errorCode":null,"errorMessage":"No hotels for city ${cityId} on ${checkin} .. ${checkout}","messagePattern":"No hotels for city (.+?) on (.+?) \\.\\. (.+?)","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/trip/hotel-search.js","lineNumber":65,"sourceCode":"            throw new ArgumentError(`--checkin must be before --checkout (got ${checkin} .. ${checkout})`);\n        }\n        const limit = parseListLimit(kwargs.limit);\n\n        const searchUrl = buildHotelSearchUrl(cityId, checkin, checkout);\n        await page.goto(searchUrl);\n        const waitResult = await page.evaluate(WAIT_FOR_HOTELS_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 hotel page did not render hotel cards (state=${String(waitResult)})`);\n        }\n        const raw = await page.evaluate(buildHotelExtractJs());\n        if (!Array.isArray(raw)) {\n            throw new CommandExecutionError('Trip.com hotel DOM extraction returned malformed rows');\n        }\n        if (raw.length === 0) {\n            throw new EmptyResultError('trip hotel-search', `No hotels for city ${cityId} on ${checkin} .. ${checkout}`);\n        }\n        return raw.slice(0, limit).map((r, i) => ({\n            rank: i + 1,\n            name: r.name,\n            score: r.score,\n            reviewLabel: r.reviewLabel,\n            reviews: r.reviews,\n            location: r.location,\n            room: r.room,\n            price: r.price,\n            currency: r.currency,\n            url: searchUrl,\n        }));\n    },\n});\n","sourceCodeStart":47,"sourceCodeEnd":81,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trip/hotel-search.js#L47-L81","documentation":"This EmptyResultError is thrown by the trip hotel-search command after page.evaluate(buildHotelExtractJs()) successfully returns an array, but that array contains zero hotel rows. It means Trip.com responded with a well-formed but empty hotel list for the requested city and date range — the scrape pipeline worked, there was simply nothing to return.","triggerScenarios":"Calling the hotel-search CLI with a cityId that has no bookable hotels on Trip.com, or with a checkin/checkout window for which the property list is empty (far-future dates, sold-out periods, or a non-hotel city id).","commonSituations":"Typo'd or stale cityId values, date ranges beyond Trip.com's bookable horizon, cities where Trip.com has no inventory, or dates already in the past.","solutions":["Verify the cityId by running a Trip.com city search first to confirm it maps to a real hotel city","Use dates in the near future (within Trip.com's booking window) and ensure checkout is after checkin","Try a broader or nearby city id to confirm Trip.com has inventory in that region","Catch EmptyResultError and treat zero rows as a valid empty result rather than a crash"],"exampleFix":"// before\nconst rows = await runTripHotelSearch({ cityId, checkin, checkout });\n// after\ntry {\n  const rows = await runTripHotelSearch({ cityId, checkin, checkout });\n} catch (e) {\n  if (e instanceof EmptyResultError) return [];\n  throw e;\n}","handlingStrategy":"fallback","validationCode":"if (!cityId || !checkin || !checkout || checkin >= checkout) {\n  throw new Error('hotel-search needs a valid cityId and a checkin date before checkout');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const hotels = await hotelSearch({ cityId, checkin, checkout });\n} catch (e) {\n  if (e.name === 'EmptyResultError') return []; // valid empty result\n  throw e;\n}","preventionTips":["Confirm the cityId via a Trip.com city search before querying hotels","Keep checkin/checkout within Trip.com's bookable window and in the future","Treat EmptyResultError for hotel queries as an empty dataset, not a failure","Fall back to a nearby major city when inventory is empty"],"tags":["scraping","empty-results","trip-com","hotels"],"backgroundTag":"empty-scrape-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}