{"record":{"id":"195371c7154b55d7","repo":"badges/shields","slug":"package-not-found","errorCode":null,"errorMessage":"package not found","messagePattern":"package not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"info","filePath":"services/aur/aur.service.js","lineNumber":40,"sourceCode":"        Popularity: Joi.number().precision(2).min(0).required(),\n        Version: Joi.string().required(),\n        OutOfDate: nonNegativeInteger.allow(null),\n        Maintainer: Joi.string().required().allow(null),\n        LastModified: nonNegativeInteger,\n      }),\n    )\n    .required(),\n}).required()\n\nclass BaseAurService extends BaseJsonService {\n  static defaultBadgeData = { label: 'aur' }\n\n  static _validate(data, schema) {\n    if (data.resultcount === 0) {\n      // Note the 'not found' response from Arch Linux is:\n      // status code = 200,\n      // body = {\"version\":1,\"type\":\"info\",\"resultcount\":0,\"results\":[]}\n      throw new NotFound({ prettyMessage: 'package not found' })\n    }\n    return super._validate(data, schema)\n  }\n\n  async fetch({ packageName }) {\n    // Please refer to the Arch wiki page for the full spec and documentation:\n    // https://wiki.archlinux.org/index.php/Aurweb_RPC_interface\n    return this._requestJson({\n      schema: aurSchema,\n      url: 'https://aur.archlinux.org/rpc',\n      options: { searchParams: { v: 5, type: 'info', arg: packageName } },\n    })\n  }\n}\n\nclass AurLicense extends BaseAurService {\n  static category = 'license'\n  static route = { base: 'aur/license', pattern: ':packageName' }","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/aur/aur.service.js#L22-L58","documentation":"The AUR service validates the JSON returned by the Arch Linux AUR RPC API before rendering the badge. Because the AUR API signals a missing package with HTTP 200 and an empty result set (resultcount: 0) rather than a 404, _validate explicitly throws NotFound so the badge renders 'package not found'. This is the library's way of translating the API's 'empty success' into a user-facing not-found state.","triggerScenarios":"Requesting an AUR badge for a packageName that does not exist in the Arch User Repository: the API returns { resultcount: 0, results: [] } with status 200, and _validate throws NotFound({ prettyMessage: 'package not found' }).","commonSituations":"Typo in the package name in the badge URL; the package was deleted from the AUR; using a package name with wrong case or missing the package base name for split packages; querying an AUR package that only exists as a git package under a different name.","solutions":["Check the package name in the badge URL against https://aur.archlinux.org and correct typos or casing.","If the package was removed or renamed, point the badge at the new package name or the package base.","Handle the NotFound in badge rendering — this is an expected outcome for nonexistent packages, not a service fault."],"exampleFix":"// before\n/badge/aur/version/some-mispeled-pkg\n// after\n/badge/aur/version/some-misspelled-pkg","handlingStrategy":"validation","validationCode":"const res = await fetch(`https://aur.archlinux.org/rpc/?v=5&type=info&arg=${pkg}`)\nconst data = await res.json()\nif (!data.resultcount) throw new Error(`AUR package '${pkg}' does not exist`)","typeGuard":null,"tryCatchPattern":"try {\n  const badge = await getAurBadge(pkg)\n} catch (e) {\n  if (e instanceof NotFound) return 'package not found'\n  throw e\n}","preventionTips":["Validate package names against the AUR search API before building badge URLs","Watch for AUR package deletions/renames in CI","Remember the AUR API returns 200 with resultcount 0 for missing packages — never rely on HTTP status alone"],"tags":["aur","not-found","arch-linux","badge"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}