jackwener/OpenCLI · warning · EmptyResultError

dockerhub search: No Docker Hub repositories matched "${quer

Error message

dockerhub search: No Docker Hub repositories matched "${query}".

What it means

dockerhub search found zero repositories in the Docker Hub API response for the query. The library throws EmptyResultError to signal the command succeeded but matched nothing, distinguishing it from network or argument failures.

Source

Thrown at clis/dockerhub/search.js:30

    name: 'search',
    access: 'read',
    description: 'Search Docker Hub repositories by keyword',
    domain: 'hub.docker.com',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search keyword (e.g. "nginx", "bitnami redis")' },
        { name: 'limit', type: 'int', default: 25, help: 'Max repositories (1-100, single Docker Hub page)' },
    ],
    columns: ['rank', 'image', 'official', 'stars', 'pulls', 'description', 'url'],
    func: async (args) => {
        const query = requireString(args.query, 'query');
        const limit = requireBoundedInt(args.limit, 25, 100);
        const url = `${HUB_BASE}/search/repositories/?query=${encodeURIComponent(query)}&page_size=${limit}`;
        const body = await hubFetch(url, 'dockerhub search');
        const list = Array.isArray(body?.results) ? body.results : [];
        if (!list.length) {
            throw new EmptyResultError('dockerhub search', `No Docker Hub repositories matched "${query}".`);
        }
        return list.slice(0, limit).map((r, i) => {
            const owner = String(r.repo_owner ?? '').trim();
            const name = String(r.repo_name ?? '').trim();
            const image = owner ? `${owner}/${name}` : (r.is_official ? `library/${name}` : name);
            return {
                rank: i + 1,
                image,
                official: Boolean(r.is_official),
                stars: r.star_count != null ? Number(r.star_count) : null,
                pulls: r.pull_count != null ? Number(r.pull_count) : null,
                description: String(r.short_description ?? '').trim(),
                url: image ? `https://hub.docker.com/r/${image}` : '',
            };
        });
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Shorten or generalize the query (e.g. 'redis' instead of 'redis-json-7-alpine')
  2. Check the spelling of the image/repo name
  3. Verify the repository actually exists and is public on hub.docker.com
  4. If the image is hosted elsewhere (ghcr.io, quay.io), search that registry instead

Example fix

// before
dockerhub search --query 'bitnami/redis-exporter-7-alpine'
// after
dockerhub search --query 'redis-exporter'
Defensive patterns

Strategy: fallback

Try / catch

try { results = await dockerhubSearch(query); } catch (e) { if (e instanceof EmptyResultError) { console.warn(`No results for "${query}"; try a broader term`); results = []; } else throw e; }

Prevention

When it happens

Trigger: Running dockerhub search with a query string that has no matching repositories on Docker Hub (e.g. a very specific or misspelled image name) while the API returns an empty results array.

Common situations: Typo in image name; searching an org's private repos that are not visible via search; query uses characters Docker Hub search does not match; image retired or never published to Docker Hub (hosted on GHCR/Quay instead).

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


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