jackwener/OpenCLI · warning · CliError

NOT_FOUND

NOT_FOUND

Error message

NOT_FOUND: No podcasts found

What it means

Thrown by `apple-podcasts search` as a CliError with code NOT_FOUND when the iTunes search endpoint returns an empty results array for the given query. The command requires at least one podcast match to build its output table. It indicates the query succeeded over the network but matched nothing.

Source

Thrown at clis/apple-podcasts/search.js:21

import { itunesFetch } from './utils.js';
cli({
    site: 'apple-podcasts',
    name: 'search',
    access: 'read',
    description: 'Search Apple Podcasts',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search keyword' },
        { name: 'limit', type: 'int', default: 10, help: 'Max results' },
    ],
    columns: ['id', 'title', 'author', 'episodes', 'genre', 'url'],
    func: async (args) => {
        const term = encodeURIComponent(args.query);
        const limit = Math.max(1, Math.min(Number(args.limit), 25));
        const data = await itunesFetch(`/search?term=${term}&media=podcast&limit=${limit}`);
        if (!data.results?.length)
            throw new CliError('NOT_FOUND', 'No podcasts found', `Try a different keyword`);
        return data.results.map((p) => ({
            id: p.collectionId,
            title: p.collectionName,
            author: p.artistName,
            episodes: p.trackCount ?? '',
            genre: p.primaryGenreName ?? '',
            url: p.collectionViewUrl || '',
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Shorten or simplify the search term (e.g. show name only, without host names)
  2. Check spelling and try synonyms or the English title
  3. Verify the podcast exists at https://podcasts.apple.com before debugging further

Example fix

// before
opencli apple-podcasts search "the daily show with trevor noah full episodes"
// NOT_FOUND: No podcasts found
// after
opencli apple-podcasts search "the daily"
Defensive patterns

Strategy: validation

Validate before calling

const term = 'the daily';
if (!term.trim()) { console.log('Provide a non-empty query'); }
// Optionally probe first:
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURIComponent(term)}&media=podcast&limit=1`);
const data = await res.json();
if (!data.results?.length) console.log('Query has no podcast matches; simplify the term.');

Type guard

function hasResults(data) {
  return data != null && Array.isArray(data.results) && data.results.length > 0;
}

Try / catch

try {
  await cli.run(['apple-podcasts', 'search', query]);
} catch (e) {
  if (e.code === 'NOT_FOUND') {
    console.log('No podcasts matched; try shorter or alternate keywords.');
  } else throw e;
}

Prevention

When it happens

Trigger: `opencli apple-podcasts search <query>` where /search?term=...&media=podcast&limit=N returns data.results with length 0 (or undefined).

Common situations: Overly specific or misspelled keywords; searching for a show not distributed on Apple Podcasts; non-English store locale with no matching titles; query that only matches music/apps (filtered out by media=podcast).

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/c23a099400889567. Report an issue: GitHub.