jackwener/OpenCLI · warning · EmptyResultError

nuget package

nuget package

Error message

No published versions found for NuGet package "${id}".

What it means

An EmptyResultError thrown after successfully fetching and parsing the registration pages but finding zero version entries. It means the package id resolved to a registration document with no published versions, so there is nothing to sort or return.

Source

Thrown at clis/nuget/package.js:71

                const leaf = await nugetFetch(pageUrl, 'nuget package page');
                if (!Array.isArray(leaf?.items)) {
                    throw new CommandExecutionError(
                        `nuget package registration leaf ${pageUrl} did not include an items array`,
                    );
                }
                pageItems = leaf.items;
            }
            for (const it of pageItems) {
                if (!it || typeof it !== 'object' || !it.catalogEntry || typeof it.catalogEntry !== 'object') {
                    throw new CommandExecutionError(
                        `nuget package registration page ${pageIndex + 1} contains a malformed version entry`,
                    );
                }
                allEntries.push(it);
            }
        }
        if (!allEntries.length) {
            throw new EmptyResultError('nuget package', `No published versions found for NuGet package "${id}".`);
        }
        // Sort by published desc; ties broken by version string descending.
        const sorted = [...allEntries].sort((a, b) => {
            const ap = a?.catalogEntry?.published ?? '';
            const bp = b?.catalogEntry?.published ?? '';
            if (ap !== bp) return bp.localeCompare(ap);
            const av = a?.catalogEntry?.version ?? '';
            const bv = b?.catalogEntry?.version ?? '';
            return bv.localeCompare(av);
        });
        return sorted.map((entry, i) => {
            const cat = entry?.catalogEntry ?? {};
            return {
                rank: i + 1,
                id: typeof cat?.id === 'string' ? cat.id : id,
                version: typeof cat?.version === 'string' ? cat.version : null,
                title: typeof cat?.title === 'string' ? cat.title : null,
                authors: joinAuthors(cat?.authors),

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Double-check the package id spelling with `nuget search <term>` or on nuget.org.
  2. Run `nuget search` first to confirm the package exists and is published.
  3. If it is a private package, verify you are querying the correct feed/source and have access.
  4. If the package was recently published, wait for CDN propagation and retry.
  5. If the package was deleted/unlisted, choose an alternative package.

Example fix

// before
try {
  const pkg = await nugetPackage('Newtonsoft.Jsonn'); // typo'd id
} catch (e) { /* EmptyResultError */ }
// after
const results = await nugetSearch('Newtonsoft.Json');
const id = results[0].id; // use the exact id from search
const pkg = await nugetPackage(id);
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(`https://api.nuget.org/v3/registration5-gz-semver2/${id.toLowerCase()}/index.json`);
if (!res.ok) throw new Error(`Package ${id} not found (HTTP ${res.status})`);

Type guard

null

Try / catch

try {
  const pkg = await nugetPackage(id);
} catch (err) {
  if (err.name === 'EmptyResultError') {
    console.warn(`Package "${id}" has no published versions; check spelling or feed`);
  } else throw err;
}

Prevention

When it happens

Trigger: Running the nuget package command with an id that is unlisted-with-no-versions, deleted from the feed, exists only as a placeholder, or whose registration index contains pages but no items after validation; also any typo'd id that still returns an empty registration index.

Common situations: Typos in the package id or wrong casing assumptions on a custom feed; package was delisted/removed from nuget.org; querying a brand-new or internal package not yet published; pointing the CLI at a private feed where the package does not exist.

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