{"record":{"id":"0843fc26913eeacf","repo":"jackwener/OpenCLI","slug":"no-destinations-for-query","errorCode":null,"errorMessage":"No destinations for \"${query}\"","messagePattern":"No destinations for \"(.+?)\"","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/trip/search.js","lineNumber":39,"sourceCode":"    browser: false,\n    args: [\n        { name: 'query', required: true, positional: true, help: 'Destination keyword (e.g. Tokyo / Bali / London)' },\n        { name: 'limit', type: 'int', default: 20, help: 'Number of suggestions (1-50)' },\n    ],\n    columns: [\n        'rank',\n        'name', 'type',\n        'cityId', 'airportCode',\n        'province', 'country',\n    ],\n    func: async (kwargs) => {\n        const query = parseKeyword('query', kwargs.query);\n        const limit = parseListLimit(kwargs.limit);\n\n        const results = await fetchPoiSearch(query);\n        const items = flattenPoiResults(results).filter((item) => item && item.name);\n        if (items.length === 0) {\n            throw new EmptyResultError('trip search', `No destinations for \"${query}\"`);\n        }\n        return items.slice(0, limit).map((item, i) => mapSearchRow(item, i));\n    },\n});\n","sourceCodeStart":21,"sourceCodeEnd":44,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trip/search.js#L21-L44","documentation":"This EmptyResultError means Trip.com's POI/destination search completed but returned no named destination items for the query string. The library treats an empty POI result as a clean 'no match' rather than a failure, so it throws EmptyResultError to signal 'nothing found' distinctly from network or auth problems.","triggerScenarios":"Calling trip search with a query that flattenPoiResults maps to zero items with a name — misspelled place names, very short/ambiguous keywords, or queries only matching non-destination POIs.","commonSituations":"Typo in city/landmark name; searching a region name Trip.com doesn't index as a POI; passing an ID or code instead of a text query; over-specific multi-word queries.","solutions":["Simplify the query to the core place name (e.g. 'Paris' not 'Paris France hotels downtown').","Check spelling; try an alternate transliteration or the local-language name.","Run a broader query and pick the intended destination from the results.","Catch EmptyResultError in your wrapper and prompt the user to refine the query."],"exampleFix":"// before\nawait tripSearch({ query: 'Köln Hbf Hauptbahnhof Germany' });\n// after\nawait tripSearch({ query: 'Cologne' });","handlingStrategy":"validation","validationCode":"const q = String(kwargs.query ?? '').trim();\nif (q.length < 2) throw new Error('query must be a place name of at least 2 characters');","typeGuard":"function isValidQuery(q) { return typeof q === 'string' && q.trim().length >= 2 && /^[\\p{L}\\s,'.-]+$/u.test(q.trim()); }","tryCatchPattern":"try {\n  const items = await tripSearch({ query });\n} catch (e) {\n  if (e instanceof EmptyResultError) return { query, results: [] };\n  throw e;\n}","preventionTips":["Normalize user input: trim, fix common misspellings, strip noise words.","Prefer simple single-city names over compound queries.","Catch EmptyResultError and offer query suggestions to the user.","Cache known-good query strings for repeated searches."],"tags":["empty-result","search","trip-com"],"backgroundTag":"empty-search-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}