{"record":{"id":"b4f099feed567ac5","repo":"badges/shields","slug":"package-not-found-b4f099","errorCode":null,"errorMessage":"package not found","messagePattern":"package not found","errorType":"exception","errorClass":"NotFound","httpStatus":null,"severity":"error","filePath":"services/react-native-directory/react-native-directory-platforms.service.js","lineNumber":85,"sourceCode":"    return {\n      message:\n        supportedPlatforms.length > 0 ? supportedPlatforms.join(' | ') : 'none',\n    }\n  }\n\n  async handle({ scope, packageName }) {\n    const name = scope ? `${scope}/${packageName}` : packageName\n    const response = await this._requestJson({\n      schema,\n      url: `https://reactnative.directory/api/library?name=${encodeURIComponent(\n        name,\n      )}`,\n      httpErrors: { 404: 'package not found' },\n    })\n\n    const library = response[name]\n    if (!library) {\n      throw new NotFound({ prettyMessage: 'package not found' })\n    }\n\n    return this.constructor.render(library)\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":91,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/react-native-directory/react-native-directory-platforms.service.js#L67-L91","documentation":"The React Native Directory badge throws NotFound 'package not found' when the directory dataset has no entry for the requested package name. The fetch already maps a 404 to the same message; a missing key in the response also triggers it. It means the library is not listed in the React Native Directory data.","triggerScenarios":"Requesting a badge for a package not present in the React Native Directory dataset; a typo in the package name; a 404 from the upstream data source (mapped via httpErrors).","commonSituations":"New libraries not yet added to the directory; scoped/private packages that aren't listed; name mismatches (npm name vs directory slug).","solutions":["Confirm the package is listed at reactnative.directory and use the exact npm name","Submit/PR the library into the React Native Directory dataset if missing","Check for typos or scope differences in the package name in the badge URL"],"exampleFix":"// before\n/badge/react-native-directory/react-native-fs   (not listed)\n// after\n/badge/react-native-directory/react-native-fs  → use listed name e.g. 'react-native-image-picker'","handlingStrategy":"validation","validationCode":"const res = await fetch('https://reactnative.directory/api/libraries')\nconst dir = await res.json()\nif (!(pkgName in dir)) throw new Error(`${pkgName} is not in the React Native Directory`)","typeGuard":"function isInDirectory(dir, name) { return dir != null && Object.prototype.hasOwnProperty.call(dir, name) && typeof dir[name] === 'object' }","tryCatchPattern":"try {\n  return await service.handle({ name: pkgName })\n} catch (err) {\n  if (err instanceof NotFound && err.prettyMessage === 'package not found') {\n    return renderBadge({ label: 'rn-directory', message: 'not listed' })\n  }\n  throw err\n}","preventionTips":["Confirm the package appears on reactnative.directory before adding the badge","Use the exact npm package name including scope if listed","Submit the library to the directory dataset if it is missing"],"tags":["badge","react-native","not-found"],"backgroundTag":"resource-not-found-in-upstream","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}