jackwener/OpenCLI · info · EmptyResultError
TVmaze returned no show for id ${id}.
Error message
TVmaze returned no show for id ${id}. What it means
This EmptyResultError is thrown when the TVmaze /shows/{id} endpoint returns a null/empty body or an object lacking an `id`, meaning no show exists for the given numeric id. The adapter validates the fetched show object after the HTTP call succeeds. It typically indicates the id does not correspond to any TVmaze show.
Source
Thrown at clis/tvmaze/show.js:31
access: 'read',
description: 'Single TVmaze TV show detail by id (network, schedule, rating, IMDB/TheTVDB cross-refs)',
domain: 'tvmaze.com',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'id', positional: true, type: 'int', required: true, help: 'TVmaze show id (positive integer)' },
],
columns: [
'id', 'name', 'type', 'language', 'genres', 'status',
'premiered', 'ended', 'runtime', 'averageRuntime', 'network',
'country', 'schedule', 'rating', 'imdb', 'thetvdb',
'officialSite', 'summary', 'url',
],
func: async (args) => {
const id = requireShowId(args.id);
const show = await tvmazeFetch(`${TVMAZE_BASE}/shows/${id}`, `tvmaze show ${id}`);
if (!show || show.id == null) {
throw new EmptyResultError('tvmaze show', `TVmaze returned no show for id ${id}.`);
}
const network = show.network?.name ?? show.webChannel?.name ?? '';
const country = show.network?.country?.name ?? show.webChannel?.country?.name ?? '';
const days = Array.isArray(show.schedule?.days) ? show.schedule.days.join(', ') : '';
const time = String(show.schedule?.time ?? '').trim();
const schedule = days || time ? `${days}${days && time ? ' ' : ''}${time}`.trim() : '';
return [{
id: Number(show.id),
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,
runtime: show.runtime == null ? null : Number(show.runtime),
averageRuntime: show.averageRuntime == null ? null : Number(show.averageRuntime),
network: String(network).trim(),View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the id by opening https://www.tvmaze.com/shows/<id> in a browser.
- Look up the show by name with `tvmaze search` and use the `show.id` from the results instead of a guessed id.
- Handle EmptyResultError in calling code and fall back to a search by title.
- If migrating ids from another provider, map them via TVmaze's lookup endpoints rather than assuming equality.
Example fix
// before
await tvmazeShow(550); // TMDB Breaking Bad id, not TVmaze
// after
const [match] = await tvmazeSearch('breaking bad');
await tvmazeShow(match.id); Defensive patterns
Strategy: validation
Validate before calling
function isTvmazeShowId(id) {
return Number.isInteger(id) && id > 0;
}
// prefer resolving ids via search:
// const [m] = await tvmazeSearch(title); if (!m) skip; await tvmazeShow(m.id); Type guard
function isPositiveInt(v) {
return typeof v === 'number' && Number.isInteger(v) && v > 0;
} Try / catch
try {
const show = await tvmazeShow(id);
} catch (err) {
if (err instanceof EmptyResultError) {
// fall back to search-by-title or report unknown id
} else {
throw err;
}
} Prevention
- Never reuse ids from TMDB/IMDB — they are not TVmaze ids
- Resolve ids via tvmaze search instead of hardcoding
- Validate ids are positive integers before calling
- Verify a suspicious id at https://www.tvmaze.com/shows/<id>
When it happens
Trigger: Calling the `tvmaze show` command with an id (after requireShowId validation) that TVmaze has no record for — a deleted/closed show, an out-of-range id, or an id taken from a different data source.
Common situations: Hardcoding an id from memory or another API (e.g., using a TMDB/IMDB numeric id instead of a TVmaze id); a bookmarked TVmaze show page whose id changed; scraping ids off by one from a list index.
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
- TVmaze returned no shows matching "${query}".
- No posts found for "${keyword}"
- openFDA returned no labels matching "${query}".
- openFDA returned no food recall records matching the filter.
- ${label} returned 404 (no matches).
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/6e27108f7245dd41.
Report an issue: GitHub.