jackwener/OpenCLI · warning · EmptyResultError
No Steam results matched "${query}".
Error message
No Steam results matched "${query}". What it means
Steam's storesearch endpoint returned successfully but with an empty items array, so the CLI throws EmptyResultError stating no results matched the query. This is an expected empty-result path for queries Steam cannot match.
Source
Thrown at clis/steam/search.js:45
description: 'Search the Steam storefront by name keyword',
domain: 'store.steampowered.com',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'query', positional: true, required: true, help: 'Search keyword (e.g. "portal", "stardew")' },
{ name: 'limit', type: 'int', default: 20, help: 'Max results (1-50)' },
{ name: 'currency', default: 'us', help: 'Storefront country code (e.g. us / cn / jp / de)' },
],
columns: ['rank', 'id', 'name', 'price', 'currency', 'metascore', 'platforms', 'url'],
func: async (args) => {
const query = requireString(args.query, 'query');
const limit = requireBoundedInt(args.limit, 20, 50);
const cc = requireCountryCode(args.currency);
const url = `${STEAM_STORE}/api/storesearch/?term=${encodeURIComponent(query)}&l=en&cc=${encodeURIComponent(cc)}`;
const body = await steamFetch(url, 'steam search');
const items = Array.isArray(body?.items) ? body.items : [];
if (!items.length) {
throw new EmptyResultError('steam search', `No Steam results matched "${query}".`);
}
return items.slice(0, limit).map((item, i) => ({
rank: i + 1,
id: String(item.id ?? ''),
name: decodeHtmlEntities(item.name ?? ''),
price: priceCents(item?.price?.final ?? null),
currency: String(item?.price?.currency ?? '').toUpperCase(),
metascore: item.metascore != null && item.metascore !== '' ? Number(item.metascore) : null,
platforms: platformList(item.platforms),
url: item.id ? `${STEAM_STORE}/app/${item.id}/` : '',
}));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Shorten or simplify the search term (use the base title, not the full subtitle)
- Try the game's official English name or alternate spellings
- Try a different currency/country code if the title may be regional
- Catch EmptyResultError and prompt the user for a broader query
Example fix
// before
const body = await steamFetch(url, 'steam search');
const items = Array.isArray(body?.items) ? body.items : [];
if (!items.length) throw new EmptyResultError('steam search', `No Steam results matched "${query}".`);
// after
if (!items.length) {
const retry = await steamFetch(url.replace(/term=[^&]+/, `term=${encodeURIComponent(query.split(/\s+/)[0])}`), 'steam search');
...
} Defensive patterns
Strategy: fallback
Validate before calling
const term = String(query ?? '').trim();
if (term.length < 2) throw new Error('search term too short'); Type guard
function hasSearchItems(body) {
return Array.isArray(body?.items) && body.items.length > 0;
} Try / catch
try {
const results = await steamSearch({ query });
} catch (e) {
if (e instanceof EmptyResultError) {
// fall back to a shortened query or inform the user no matches exist
} else throw e;
} Prevention
- Use the base game title without subtitles for better recall
- Match the term language to the storefront country
- Suggest alternate spellings to users on empty results
- Catch EmptyResultError and offer query refinement rather than failing
When it happens
Trigger: Search term with no store matches; term in a language not used by the storefront for the given cc; overly specific multi-word queries; very short or garbled terms.
Common situations: Searching indie/niche titles under a regional storefront where they are not sold; misspelling game names; using localized names against an English storefront (or vice versa).
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No 12306 stations match "${keyword}"
- ${label}
- No papers found for author "${authorText}". Try alternate sp
- No papers found. Try a different keyword.
- crates search
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5840b693a0d71306.
Report an issue: GitHub.