{"record":{"id":"95cc687344224181","repo":"badges/shields","slug":"track-not-found-95cc68","errorCode":null,"errorMessage":"track not found","messagePattern":"track not found","errorType":"exception","errorClass":"NotFound","httpStatus":null,"severity":"warning","filePath":"services/snapcraft/snapcraft-version.service.js","lineNumber":74,"sourceCode":"  static defaultBadgeData = { label: 'snapcraft' }\n\n  static render({ version }) {\n    return renderVersionBadge({ version })\n  }\n\n  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(versionSchema, { packageName })\n\n    // filter results by track, risk and arch\n    const { version } = this.constructor.transform(\n      parsedData,\n      track,","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/snapcraft/snapcraft-version.service.js#L56-L92","documentation":"After filtering by architecture succeeds, `transform` filters the channel-map by the requested `track`. If no channel for that arch has that track (e.g. a non-default track like '3.x' or 'beta-track'), a NotFound with 'track not found' is thrown.","triggerScenarios":"Calling /snapcraft-version with `track=<name>` where the snap has no channels under that track for the given arch, e.g. track=4.0 for a snap that only publishes latest.","commonSituations":"Asking for an older/newer major-version track that the maintainer never created; assuming every snap has LTS tracks like Node's; typo in track name ('stable' is a risk, not a track).","solutions":["Verify the snap's tracks via `snap info <name>` (lists tracks under 'channels') or the store page","Omit the track param to use the default 'latest' track","Correct the track name casing/spelling exactly as it appears in the store","If the track should exist, push a release to it with `snapcraft release <revision> <track/risk>`"],"exampleFix":"// before\n/badge/snapcraft-version/my-snap?track=stable\n// after (stable is a risk, not a track)\n/badge/snapcraft-version/my-snap","handlingStrategy":"try-catch","validationCode":"const snapInfo = await getSnapInfo(packageName); // snap info <name>\nif (track && !snapInfo.tracks.includes(track)) throw new Error(`track ${track} not published`);","typeGuard":"const trackExists = (track, tracks) => !track || (typeof track === 'string' && tracks.includes(track));","tryCatchPattern":"try {\n  return await getSnapcraftVersion({ package: name, track, risk, arch });\n} catch (err) {\n  if (err prettyMessage === 'track not found') return getSnapcraftVersion({ package: name, risk, arch }); // omit track\n  throw err;\n}","preventionTips":["Enumerate tracks via `snap info <name>` or the store API before requesting a track","Remember 'stable'/'edge' are risks, not tracks; tracks are version-like names ('latest', '3.x')","Default to latest track when unsure"],"tags":["snapcraft","not-found","track","query-param"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}