{"record":{"id":"856de67e8d71d975","repo":"badges/shields","slug":"package-not-found-856de6","errorCode":null,"errorMessage":"package not found","messagePattern":"package not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/vpm/vpm-version.service.js","lineNumber":74,"sourceCode":"  static defaultBadgeData = {\n    label: 'vpm',\n  }\n\n  async fetch({ repositoryUrl }) {\n    return this._requestJson({\n      schema,\n      url: repositoryUrl,\n    })\n  }\n\n  async handle(\n    { packageId },\n    { repository_url: repositoryUrl, include_prereleases: prereleases },\n  ) {\n    const data = await this.fetch({ repositoryUrl })\n    const pkg = data.packages[packageId]\n    if (pkg === undefined)\n      throw new NotFound({ prettyMessage: 'package not found' })\n    const versions = Object.keys(pkg.versions)\n    const version = latest(versions, { pre: prereleases !== undefined })\n\n    return renderVersionBadge({ version })\n  }\n}\n","sourceCodeStart":56,"sourceCodeEnd":81,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/vpm/vpm-version.service.js#L56-L81","documentation":"The VPM (Unity package manager) version service throws NotFound with message 'package not found' when the fetched VPM registry JSON has no entry for the requested packageId. The registry responded fine, but data.packages[packageId] is undefined.","triggerScenarios":"Querying vpm-version with a packageId not present in the repository's packages list, e.g. a package that moved to another registry or was renamed.","commonSituations":"Package renamed or republished under a different id, wrong repositoryUrl that hosts a different set of packages, third-party registry no longer listing the package.","solutions":["Confirm the packageId matches the 'name' field in the package's package.json","Check that repositoryUrl points to the registry actually hosting the package","Search the VPM registry listing for the correct current id","Remove the badge if the package is gone"],"exampleFix":"// before\n{ packageId: 'com.example.old-name', repositoryUrl: 'https://example.com/vpm.json' }\n// after\n{ packageId: 'com.example.new-name', repositoryUrl: 'https://example.com/vpm.json' }","handlingStrategy":"try-catch","validationCode":"const registry = await fetch(repositoryUrl).then(r => r.json())\nif (!(packageId in registry.packages)) throw new Error(`packageId ${packageId} not in registry`);","typeGuard":"function pkgExists(data, packageId) { return data?.packages != null && Object.prototype.hasOwnProperty.call(data.packages, packageId) }","tryCatchPattern":"try {\n  const badge = await vpmVersion.handle({ packageId, repositoryUrl })\n} catch (e) {\n  if (e.message === 'package not found') {\n    // fall back to 'vpm | package not found' badge\n  } else throw e\n}","preventionTips":["Match packageId exactly to the 'name' field in the package's package.json","Point repositoryUrl at the registry that actually hosts the package","Re-check the registry listing after any package rename or republish"],"tags":["not-found","upstream-api","registry","package"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}