jackwener/OpenCLI · info · EmptyResultError
TVmaze returned no shows matching "${query}".
Error message
TVmaze returned no shows matching "${query}". What it means
This EmptyResultError is thrown when the TVmaze /search/shows API responds successfully but returns an empty array (or a non-array), meaning no shows matched the query string. The adapter treats 'no results' as a distinct, expected outcome rather than a network or parsing failure. It is informational about search specificity, not a malfunction.
Source
Thrown at clis/tvmaze/search.js:37
browser: false,
args: [
{ name: 'query', positional: true, type: 'string', required: true, help: 'TV show title or fragment to search for' },
{ name: 'limit', type: 'int', default: 20, help: 'Max rows to return (1-50)' },
],
columns: [
'rank', 'id', 'name', 'type', 'language', 'genres',
'status', 'premiered', 'ended', 'network', 'rating',
'matchScore', 'summary', 'url',
],
func: async (args) => {
const query = requireString(args.query, 'query');
const limit = requireBoundedInt(args.limit, 20, 50, 'limit');
const list = await tvmazeFetch(
`${TVMAZE_BASE}/search/shows?q=${encodeURIComponent(query)}`,
`tvmaze search ${query}`,
);
if (!Array.isArray(list) || list.length === 0) {
throw new EmptyResultError('tvmaze search', `TVmaze returned no shows matching "${query}".`);
}
const rows = list.slice(0, limit).map((entry, i) => {
const show = entry?.show ?? {};
const network = show.network?.name ?? show.webChannel?.name ?? '';
return {
rank: i + 1,
id: typeof show.id === 'number' ? show.id : null,
name: String(show.name ?? '').trim(),
type: String(show.type ?? '').trim(),
language: String(show.language ?? '').trim(),
genres: joinList(show.genres),
status: String(show.status ?? '').trim(),
premiered: typeof show.premiered === 'string' ? show.premiered : null,
ended: typeof show.ended === 'string' ? show.ended : null,
network: String(network).trim(),
rating: show.rating?.average == null ? null : Number(show.rating.average),
matchScore: typeof entry?.score === 'number' ? entry.score : null,
summary: stripHtml(show.summary),View on GitHub (pinned to 49907e53dc)
Solutions
- Shorten and simplify the query to the core show title.
- Check spelling of the show name.
- Search the title directly on tvmaze.com to confirm it exists in their database.
- Handle EmptyResultError in calling code and prompt the user for a different query.
Example fix
// before
await tvmazeSearch('game of thrones season 2 episode 1');
// after
await tvmazeSearch('game of thrones'); Defensive patterns
Strategy: try-catch
Validate before calling
const q = String(query ?? '').trim();
if (!q) throw new Error('A non-empty show title is required before calling tvmaze search'); Type guard
function isNonEmptyString(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
const rows = await tvmazeSearch(query);
} catch (err) {
if (err instanceof EmptyResultError) {
console.log(`No TVmaze shows found for "${query}"; try a shorter title.`);
} else {
throw err;
}
} Prevention
- Trim and simplify queries to the core show title before searching
- Check the title exists on tvmaze.com when a search unexpectedly returns nothing
- Always handle EmptyResultError separately from network errors
- Avoid appending season/episode detail to search queries
When it happens
Trigger: Calling the `tvmaze search` command with a query string that matches zero shows in the TVmaze database — typos, very obscure titles, or over-specific queries like 'game of thrones season 2'.
Common situations: Misspelled show names; searching by actor or character name instead of show title; searching non-English titles not indexed by TVmaze; passing the full episode title instead of the series name.
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 Semantic Scholar papers matched "${query}".
- TVmaze returned no show for id ${id}.
- No items match "${query}" on archive.org.
- Bilibili user search returned malformed result for ${input}
- No hotels rendered (${totalText}). Try a broader destination
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/0860a589ecc48d3a.
Report an issue: GitHub.