badges/shields · error · NotFound
package not found
Error message
package not found
What it means
The NuGet v3 service's transform() throws NotFound 'package not found' when the flattened search/document response has no data entries for the given package (json.data is empty). It distinguishes an empty result from HTTP 404 at the transport layer, producing a consistent not-found badge state. Called from the version service when resolving the latest/current version for a package id on a tenant/feed.
Source
Thrown at services/nuget/nuget-v3-service-family.js:141
static openApi = {}
static defaultBadgeData = {
label: defaultLabel,
}
/*
* Extract version information from the raw package info.
*/
transform({ json, includePrereleases }) {
if (json.data.length === 1 && json.data[0].versions.length > 0) {
const { versions: packageVersions } = json.data[0]
const versions = packageVersions.map(item =>
stripBuildMetadata(item.version),
)
return selectVersion(versions, includePrereleases)
} else {
throw new NotFound({ prettyMessage: 'package not found' })
}
}
async handle({ tenant, feed, which, packageName }) {
const includePrereleases = which === 'vpre'
const baseUrl = apiUrl({
withTenant,
apiBaseUrl,
apiDomain,
tenant,
withFeed,
feed,
})
const json = await fetch(this, { baseUrl, packageName })
const version = this.transform({ json, includePrereleases })
return renderVersionBadge({ version, defaultLabel: feed })
}
}View on GitHub (pinned to 766fd8bc89)
Solutions
- Verify the package exists on that feed (dotnet package search / nuget.org or the feed UI) and check the id spelling
- Confirm the tenant/feed route segments in the badge URL match your actual feed (tenant hostname and feed name)
- Push the package to the feed (`dotnet nuget push`) if it is genuinely missing
- If using a private feed view, ensure the package is visible in the view the service queries
Example fix
// before /nuget/v3/nonexistent-tenant/vpre/MyPackage.svg // after /nuget/v3/mytenant/vpre/MyPackage.svg // tenant/feed that actually hosts MyPackage
Defensive patterns
Strategy: fallback
Validate before calling
const res = await fetch(`${feedUrl}/query?q=packageid:${pkg}&prerelease=true`)
const json = await res.json()
if (!json.data || json.data.length === 0) {
throw new Error(`package '${pkg}' not found on feed`)
} Type guard
function packageExistsInFeed(json) {
return json != null && Array.isArray(json.data) && json.data.length > 0
} Try / catch
try {
return await nugetV3Badge({ tenant, feed, pkg, which })
} catch (e) {
if (e instanceof NotFound && e.message === 'package not found') {
return renderBadge('package not found', 'lightgrey')
}
throw e
} Prevention
- Verify the package id on the exact tenant/feed before generating badges — feeds are isolated
- Check that the package is visible in the feed view (release vs prerelease) the service queries
- For private feeds, confirm credentials/route config so the search endpoint returns your packages
- Add a CI check that all badge-referenced packages still exist on their feeds
When it happens
Trigger: Querying a nuget v3 badge for a package id that does not exist on the configured tenant/feed; wrong tenant hostname or private feed (e.g. Azure DevOps feed) missing the package; case-sensitive/typo'd package id; feed URL pattern changes upstream.
Common situations: Private feeds where the package was never pushed or was deleted; using nuget.org package ids against a custom tenant; feed views (prerelease vs release view) hiding the package; expired/misconfigured feed routes.
Related errors
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/c8132db365b7e7dc.
Report an issue: GitHub.