badges/shields · info · NotFound

package not found

Error message

package not found

What it means

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.

Source

Thrown at services/aur/aur.service.js:40

        Popularity: Joi.number().precision(2).min(0).required(),
        Version: Joi.string().required(),
        OutOfDate: nonNegativeInteger.allow(null),
        Maintainer: Joi.string().required().allow(null),
        LastModified: nonNegativeInteger,
      }),
    )
    .required(),
}).required()

class BaseAurService extends BaseJsonService {
  static defaultBadgeData = { label: 'aur' }

  static _validate(data, schema) {
    if (data.resultcount === 0) {
      // Note the 'not found' response from Arch Linux is:
      // status code = 200,
      // body = {"version":1,"type":"info","resultcount":0,"results":[]}
      throw new NotFound({ prettyMessage: 'package not found' })
    }
    return super._validate(data, schema)
  }

  async fetch({ packageName }) {
    // Please refer to the Arch wiki page for the full spec and documentation:
    // https://wiki.archlinux.org/index.php/Aurweb_RPC_interface
    return this._requestJson({
      schema: aurSchema,
      url: 'https://aur.archlinux.org/rpc',
      options: { searchParams: { v: 5, type: 'info', arg: packageName } },
    })
  }
}

class AurLicense extends BaseAurService {
  static category = 'license'
  static route = { base: 'aur/license', pattern: ':packageName' }

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Check the package name in the badge URL against https://aur.archlinux.org and correct typos or casing.
  2. If the package was removed or renamed, point the badge at the new package name or the package base.
  3. Handle the NotFound in badge rendering — this is an expected outcome for nonexistent packages, not a service fault.

Example fix

// before
/badge/aur/version/some-mispeled-pkg
// after
/badge/aur/version/some-misspelled-pkg
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`https://aur.archlinux.org/rpc/?v=5&type=info&arg=${pkg}`)
const data = await res.json()
if (!data.resultcount) throw new Error(`AUR package '${pkg}' does not exist`)

Try / catch

try {
  const badge = await getAurBadge(pkg)
} catch (e) {
  if (e instanceof NotFound) return 'package not found'
  throw e
}

Prevention

When it happens

Trigger: 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' }).

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/195371c7154b55d7. Report an issue: GitHub.