badges/shields · error · NotFound
risk not found
Error message
risk not found
What it means
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.
Source
Thrown at services/snapcraft/snapcraft-last-update.service.js:76
static transform(apiData, track, risk, arch) {
const channelMap = apiData['channel-map']
let filteredChannelMap = channelMap.filter(
({ channel }) => channel.architecture === arch,
)
if (filteredChannelMap.length === 0) {
throw new NotFound({ prettyMessage: 'arch not found' })
}
filteredChannelMap = filteredChannelMap.filter(
({ channel }) => channel.track === track,
)
if (filteredChannelMap.length === 0) {
throw new NotFound({ prettyMessage: 'track not found' })
}
filteredChannelMap = filteredChannelMap.filter(
({ channel }) => channel.risk === risk,
)
if (filteredChannelMap.length === 0) {
throw new NotFound({ prettyMessage: 'risk not found' })
}
return filteredChannelMap[0]
}
async handle({ package: packageName, track, risk }, { arch = 'amd64' }) {
const parsedData = await this.fetch(lastUpdateSchema, { packageName })
// filter results by track, risk and arch
const { channel } = this.constructor.transform(
parsedData,
track,
risk,
arch,
)
return renderDateBadge(channel['released-at'])
}View on GitHub (pinned to 766fd8bc89)
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
Example fix
// before https://img.shields.io/snapcraft/v/mytools/4.0/stable // after (only edge is published for this track) https://img.shields.io/snapcraft/v/mytools/4.0/edge
Defensive patterns
Strategy: validation
Validate before calling
// Verify the risk level exists for the snap's track/arch before requesting the badge
const RISKS = ['stable','candidate','beta','edge']
async function riskPublished(snap, track, risk, arch = 'amd64') {
if (!RISKS.includes(risk)) return false
const res = await fetch(`https://api.snapcraft.io/v2/snaps/info/${snap}`, { headers: { 'Snap-Device-Series': '16' } })
const info = await res.json()
return (info['channel-map'] || []).some(c =>
c.channel.track === track && c.channel.risk === risk && c.channel.architecture === arch)
}
if (!(await riskPublished('mytools', '4.0', 'stable'))) throw new Error('risk not published') Type guard
function isValidRisk(risk) {
return ['stable','candidate','beta','edge'].includes(risk)
} Try / catch
try {
const badge = await fetchBadgeUrl(snapcraftBadgeUrl)
} catch (e) {
if (/risk not found/.test(e.message)) {
console.warn('Risk level not published for this snap/track; use edge or check the Store page')
} else throw e
} Prevention
- 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
When it happens
Trigger: 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'.
Common situations: 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.
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
- track not found
- arch not found
- repo not found: ${repoName}
- bucket "${bucket}" not found
- ${app} not found in bucket "${bucket}"
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/5ca9612062458858.
Report an issue: GitHub.