jackwener/OpenCLI · warning · CliError

NOT_FOUND

NOT_FOUND

Error message

NOT_FOUND: No episodes found

What it means

Thrown by `apple-podcasts episodes` as a CliError with code NOT_FOUND when the iTunes lookup for the given podcast id returns no results with kind === 'podcast-episode'. results[0] is the podcast itself; if no episode entries follow, there is nothing to list. The hint points users at the search command to find a valid id.

Source

Thrown at clis/apple-podcasts/episodes.js:22

cli({
    site: 'apple-podcasts',
    name: 'episodes',
    access: 'read',
    description: 'List recent episodes of an Apple Podcast (use ID from search)',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'id', positional: true, required: true, help: 'Podcast ID (collectionId from search output)' },
        { name: 'limit', type: 'int', default: 15, help: 'Max episodes to show' },
    ],
    columns: ['title', 'duration', 'date'],
    func: async (args) => {
        const limit = Math.max(1, Math.min(Number(args.limit), 200));
        // results[0] is the podcast itself; the rest are episodes
        const data = await itunesFetch(`/lookup?id=${args.id}&entity=podcastEpisode&limit=${limit + 1}`);
        const episodes = (data.results ?? []).filter((r) => r.kind === 'podcast-episode');
        if (!episodes.length)
            throw new CliError('NOT_FOUND', 'No episodes found', 'Check the podcast ID from: opencli apple-podcasts search <keyword>');
        return episodes.slice(0, limit).map((ep) => ({
            title: ep.trackName,
            duration: formatDuration(ep.trackTimeMillis),
            date: formatDate(ep.releaseDate),
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the id with `opencli apple-podcasts search <keyword>` and use the id it prints
  2. Confirm the show actually has published episodes in the Apple Podcasts app
  3. Retry later — the iTunes feed occasionally returns partial results

Example fix

// before
opencli apple-podcasts episodes --id 120036366  // id is actually an app
// after
opencli apple-podcasts search "daily news"
opencli apple-podcasts episodes --id <id-from-search>
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check the id resolves to a podcast with episodes
const res = await fetch(`https://itunes.apple.com/lookup?id=${id}&entity=podcastEpisode&limit=2`);
const data = await res.json();
const hasEpisodes = (data.results ?? []).some((r) => r.kind === 'podcast-episode');
if (!hasEpisodes) console.log('No episodes for this id — verify via apple-podcasts search.');

Type guard

function isPodcastEpisode(r) {
  return r != null && typeof r === 'object' && r.kind === 'podcast-episode';
}

Try / catch

try {
  await cli.run(['apple-podcasts', 'episodes', '--id', String(id)]);
} catch (e) {
  if (e.code === 'NOT_FOUND') {
    console.log('No episodes found; check the ID via apple-podcasts search.');
  } else throw e;
}

Prevention

When it happens

Trigger: `opencli apple-podcasts episodes --id <id>` where /lookup?id=...&entity=podcastEpisode returns a payload whose results array, after filtering to kind==='podcast-episode', is empty.

Common situations: Passing a non-podcast collectionId (e.g. a song or app id); a podcast with zero published episodes; an id whose lookup returns only the podcast record but no episodes (feed temporarily unavailable); typo'd or stale id.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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