{"record":{"id":"5ca9612062458858","repo":"badges/shields","slug":"risk-not-found","errorCode":null,"errorMessage":"risk not found","messagePattern":"risk not found","errorType":"exception","errorClass":"NotFound","httpStatus":null,"severity":"error","filePath":"services/snapcraft/snapcraft-last-update.service.js","lineNumber":76,"sourceCode":"  static transform(apiData, track, risk, arch) {\n    const channelMap = apiData['channel-map']\n    let filteredChannelMap = channelMap.filter(\n      ({ channel }) => channel.architecture === arch,\n    )\n    if (filteredChannelMap.length === 0) {\n      throw new NotFound({ prettyMessage: 'arch not found' })\n    }\n    filteredChannelMap = filteredChannelMap.filter(\n      ({ channel }) => channel.track === track,\n    )\n    if (filteredChannelMap.length === 0) {\n      throw new NotFound({ prettyMessage: 'track not found' })\n    }\n    filteredChannelMap = filteredChannelMap.filter(\n      ({ channel }) => channel.risk === risk,\n    )\n    if (filteredChannelMap.length === 0) {\n      throw new NotFound({ prettyMessage: 'risk not found' })\n    }\n\n    return filteredChannelMap[0]\n  }\n\n  async handle({ package: packageName, track, risk }, { arch = 'amd64' }) {\n    const parsedData = await this.fetch(lastUpdateSchema, { packageName })\n\n    // filter results by track, risk and arch\n    const { channel } = this.constructor.transform(\n      parsedData,\n      track,\n      risk,\n      arch,\n    )\n\n    return renderDateBadge(channel['released-at'])\n  }","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/snapcraft/snapcraft-last-update.service.js#L58-L94","documentation":"Thrown when the channel-map filtered by architecture and track contains no entries matching the requested risk (stable, candidate, beta, edge). The snap publishes that arch/track combination but not this risk level, so the last-update time can't be determined.","triggerScenarios":"Requesting a last-update badge with a `risk` parameter not published for the chosen snap/track — e.g. risk=stable when the snap only pushes edge builds for that track, or a typo like 'stab1e'.","commonSituations":"Maintainers only release edge/candidate builds for a track; user assumes all four risks exist; risk name misspelled or capitalized; requesting risk on a branch-level channel that doesn't publish it.","solutions":["Check the snap's Channels tab on the Snap Store and use a published risk for that track (stable/candidate/beta/edge)","Fall back to risk=edge which most actively-developed snaps publish","Fix the spelling/case of the risk parameter","Combine with a verified track — the risk must exist within the requested track"],"exampleFix":"// before\nhttps://img.shields.io/snapcraft/v/mytools/4.0/stable\n// after (only edge is published for this track)\nhttps://img.shields.io/snapcraft/v/mytools/4.0/edge","handlingStrategy":"validation","validationCode":"// Verify the risk level exists for the snap's track/arch before requesting the badge\nconst RISKS = ['stable','candidate','beta','edge']\nasync function riskPublished(snap, track, risk, arch = 'amd64') {\n  if (!RISKS.includes(risk)) return false\n  const res = await fetch(`https://api.snapcraft.io/v2/snaps/info/${snap}`, { headers: { 'Snap-Device-Series': '16' } })\n  const info = await res.json()\n  return (info['channel-map'] || []).some(c =>\n    c.channel.track === track && c.channel.risk === risk && c.channel.architecture === arch)\n}\nif (!(await riskPublished('mytools', '4.0', 'stable'))) throw new Error('risk not published')","typeGuard":"function isValidRisk(risk) {\n  return ['stable','candidate','beta','edge'].includes(risk)\n}","tryCatchPattern":"try {\n  const badge = await fetchBadgeUrl(snapcraftBadgeUrl)\n} catch (e) {\n  if (/risk not found/.test(e.message)) {\n    console.warn('Risk level not published for this snap/track; use edge or check the Store page')\n  } else throw e\n}","preventionTips":["Validate risk against stable/candidate/beta/edge","Check the Channels tab for which risks actually have releases in the chosen track","Fall back to edge for tracks where maintainers only publish pre-releases","Re-verify after arch/track changes since risk availability depends on the combination"],"tags":["snapcraft","not-found","channel","badge","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}