jackwener/OpenCLI · info · EmptyResultError

No destinations for "${query}"

Error message

No destinations for "${query}"

What it means

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.

Source

Thrown at clis/trip/search.js:39

    browser: false,
    args: [
        { name: 'query', required: true, positional: true, help: 'Destination keyword (e.g. Tokyo / Bali / London)' },
        { name: 'limit', type: 'int', default: 20, help: 'Number of suggestions (1-50)' },
    ],
    columns: [
        'rank',
        'name', 'type',
        'cityId', 'airportCode',
        'province', 'country',
    ],
    func: async (kwargs) => {
        const query = parseKeyword('query', kwargs.query);
        const limit = parseListLimit(kwargs.limit);

        const results = await fetchPoiSearch(query);
        const items = flattenPoiResults(results).filter((item) => item && item.name);
        if (items.length === 0) {
            throw new EmptyResultError('trip search', `No destinations for "${query}"`);
        }
        return items.slice(0, limit).map((item, i) => mapSearchRow(item, i));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Simplify the query to the core place name (e.g. 'Paris' not 'Paris France hotels downtown').
  2. Check spelling; try an alternate transliteration or the local-language name.
  3. Run a broader query and pick the intended destination from the results.
  4. Catch EmptyResultError in your wrapper and prompt the user to refine the query.

Example fix

// before
await tripSearch({ query: 'Köln Hbf Hauptbahnhof Germany' });
// after
await tripSearch({ query: 'Cologne' });
Defensive patterns

Strategy: validation

Validate before calling

const q = String(kwargs.query ?? '').trim();
if (q.length < 2) throw new Error('query must be a place name of at least 2 characters');

Type guard

function isValidQuery(q) { return typeof q === 'string' && q.trim().length >= 2 && /^[\p{L}\s,'.-]+$/u.test(q.trim()); }

Try / catch

try {
  const items = await tripSearch({ query });
} catch (e) {
  if (e instanceof EmptyResultError) return { query, results: [] };
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/0843fc26913eeacf. Report an issue: GitHub.