{"record":{"id":"bf9d2cc4f4f958a9","repo":"badges/shields","slug":"not-found-bf9d2c","errorCode":null,"errorMessage":"not found","messagePattern":"not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"info","filePath":"services/itunes/itunes.service.js","lineNumber":49,"sourceCode":"  }\n\n  static defaultBadgeData = { label: 'itunes app store' }\n\n  async fetch({ bundleId }) {\n    return this._requestJson({\n      schema,\n      url: `https://itunes.apple.com/lookup?id=${bundleId}`,\n    })\n  }\n\n  async handle({ bundleId }) {\n    const data = await this.fetch({ bundleId })\n\n    if (data.resultCount === 0) {\n      // Note the 'not found' response from iTunes is:\n      // status code = 200,\n      // body = { \"resultCount\":0, \"results\": [] }\n      throw new NotFound()\n    }\n\n    return renderVersionBadge({ version: data.results[0].version })\n  }\n}\n","sourceCodeStart":31,"sourceCodeEnd":55,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/itunes/itunes.service.js#L31-L55","documentation":"The iTunes/APP Store version service throws a generic NotFound when the iTunes lookup API responds with HTTP 200 but resultCount === 0 and an empty results array. iTunes signals 'not found' with a success status code rather than a 404, so the service must detect it from the body.","triggerScenarios":"Requesting a version badge with a bundleId that does not exist on the App Store, an app that was pulled from the store, or a bundleId for a different platform/region than the one queried.","commonSituations":"App removed by Apple or by the developer; typo in the bundle identifier; app not available in the region used by the lookup; bundleId belongs to a beta/TestFlight build never publicly released.","solutions":["Verify the bundleId in the badge URL exactly matches the app's App Store bundle identifier","Confirm the app is still publicly listed on the App Store (not region-locked or removed)","If the app is region-restricted, query a country where it is available if the service supports it","Remove the version badge for delisted apps"],"exampleFix":"// before\n[![itunes](https://img.shields.io/itunes/v/bundle.id.wrong)]\n// after (correct bundle id)\n[![itunes](https://img.shields.io/itunes/v/com.example.myapp)]","handlingStrategy":"type-guard","validationCode":"const data = await (await fetch(`https://itunes.apple.com/lookup?bundleId=${bundleId}`)).json()\nif (!data || data.resultCount === 0) console.warn(`No App Store app found for bundleId ${bundleId}`)","typeGuard":"const hasResults = (data) => data != null && typeof data.resultCount === 'number' && data.resultCount > 0 && Array.isArray(data.results)","tryCatchPattern":"try {\n  const version = await service.handle({ bundleId })\n} catch (e) {\n  if (e instanceof NotFound) {\n    // iTunes returns 200 with resultCount:0 for missing apps\n    // render 'not on App Store' badge\n  } else throw e\n}","preventionTips":["Copy the bundleId exactly from App Store Connect or the app's store page","Confirm the app is publicly listed (not removed or region-locked)","Remember iTunes signals not-found with HTTP 200 and resultCount:0, not 404"],"tags":["itunes","app-store","not-found","lookup"],"backgroundTag":"entity-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}