{"record":{"id":"c8132db365b7e7dc","repo":"badges/shields","slug":"package-not-found-c8132d","errorCode":null,"errorMessage":"package not found","messagePattern":"package not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/nuget/nuget-v3-service-family.js","lineNumber":141,"sourceCode":"\n    static openApi = {}\n\n    static defaultBadgeData = {\n      label: defaultLabel,\n    }\n\n    /*\n     * Extract version information from the raw package info.\n     */\n    transform({ json, includePrereleases }) {\n      if (json.data.length === 1 && json.data[0].versions.length > 0) {\n        const { versions: packageVersions } = json.data[0]\n        const versions = packageVersions.map(item =>\n          stripBuildMetadata(item.version),\n        )\n        return selectVersion(versions, includePrereleases)\n      } else {\n        throw new NotFound({ prettyMessage: 'package not found' })\n      }\n    }\n\n    async handle({ tenant, feed, which, packageName }) {\n      const includePrereleases = which === 'vpre'\n      const baseUrl = apiUrl({\n        withTenant,\n        apiBaseUrl,\n        apiDomain,\n        tenant,\n        withFeed,\n        feed,\n      })\n      const json = await fetch(this, { baseUrl, packageName })\n      const version = this.transform({ json, includePrereleases })\n      return renderVersionBadge({ version, defaultLabel: feed })\n    }\n  }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/nuget/nuget-v3-service-family.js#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n/nuget/v3/nonexistent-tenant/vpre/MyPackage.svg\n// after\n/nuget/v3/mytenant/vpre/MyPackage.svg   // tenant/feed that actually hosts MyPackage","handlingStrategy":"fallback","validationCode":"const res = await fetch(`${feedUrl}/query?q=packageid:${pkg}&prerelease=true`)\nconst json = await res.json()\nif (!json.data || json.data.length === 0) {\n  throw new Error(`package '${pkg}' not found on feed`)\n}","typeGuard":"function packageExistsInFeed(json) {\n  return json != null && Array.isArray(json.data) && json.data.length > 0\n}","tryCatchPattern":"try {\n  return await nugetV3Badge({ tenant, feed, pkg, which })\n} catch (e) {\n  if (e instanceof NotFound && e.message === 'package not found') {\n    return renderBadge('package not found', 'lightgrey')\n  }\n  throw e\n}","preventionTips":["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"],"tags":["nuget","not-found","upstream","registry"],"backgroundTag":"package-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}