{"record":{"id":"4ea92c07b443b792","repo":"jackwener/OpenCLI","slug":"no-coaches-for-fromcity-to-tocity-on-date","errorCode":null,"errorMessage":"No coaches for ${fromCity} to ${toCity} on ${date}","messagePattern":"No coaches for (.+?) to (.+?) on (.+?)","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/ctrip/bus.js","lineNumber":72,"sourceCode":"        const searchUrl = buildBusListUrl(fromCity, toCity, date);\n        await page.goto(searchUrl);\n        const waitResult = await page.evaluate(WAIT_FOR_BUS_JS);\n        if (waitResult === 'captcha') {\n            throw new AuthRequiredError('bus.ctrip.com', 'Ctrip is asking for a captcha; complete it in your browser session and retry');\n        }\n        if (waitResult !== 'content') {\n            throw new CommandExecutionError(`Ctrip bus page did not render schedule rows (state=${String(waitResult)})`);\n        }\n        const renderedCardCount = await page.evaluate(buildScrollUntilJs('.list-item-parent', limit));\n        const raw = await page.evaluate(buildBusExtractJs());\n        if (!Array.isArray(raw)) {\n            throw new CommandExecutionError('Ctrip bus DOM extraction returned malformed rows');\n        }\n        if (raw.length === 0) {\n            if (Number(renderedCardCount) > 0) {\n                throw new CommandExecutionError('Ctrip bus rows rendered but parser did not find required schedule anchors');\n            }\n            throw new EmptyResultError('ctrip bus', `No coaches for ${fromCity} to ${toCity} on ${date}`);\n        }\n        return raw.slice(0, limit).map((r, i) => ({\n            rank: i + 1,\n            departureTime: r.departureTime,\n            fromStation: r.fromStation,\n            toStation: r.toStation,\n            duration: r.duration,\n            price: r.price,\n            status: r.status,\n            url: searchUrl,\n        }));\n    },\n});\n","sourceCodeStart":54,"sourceCodeEnd":86,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/ctrip/bus.js#L54-L86","documentation":"The page loaded fine, no captcha appeared, and the extractor returned an empty array with zero rendered cards — Ctrip genuinely has no bus departures for the requested route/date. The CLI throws EmptyResultError so the caller can distinguish 'no data' from 'scraping failed'.","triggerScenarios":"`clis ctrip bus --from X --to Y --date D` where Ctrip's list page renders zero .list-item-parent cards for that city pair and date (e.g. distant future dates, holidays with cancelled service, or routes with no bus service).","commonSituations":"Querying a route served only by train/plane; asking for a date beyond Ctrip's booking window; typos in city names resolving to small towns without bus routes.","solutions":["Try a nearby or earlier date within the booking window","Verify the city pair actually has bus service (try the route on bus.ctrip.com manually)","Check city name normalization — a wrong alias may resolve to an unintended city","Treat EmptyResultError as an expected empty response in your automation, not a failure to retry"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  rows = await ctripBusList({ from, to, date });\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    console.info(`No buses found for ${route} on ${date} — treating as empty, not failure`);\n    rows = [];\n  } else {\n    throw e;\n  }\n}","preventionTips":["Catch EmptyResultError separately from CommandExecutionError — do not retry empty results","Validate the route has bus service and the date is within ctrip's booking window","Check city-name normalization before blaming the data","Model empty results as a normal outcome in downstream pipelines"],"tags":["empty-result","ctrip","no-data","scraping"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}