{"record":{"id":"13010ea24988efa9","repo":"yarnpkg/yarn","slug":"release-not-found-range","errorCode":null,"errorMessage":"Release not found: ${range}","messagePattern":"Release not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/commands/policies.js","lineNumber":144,"sourceCode":"    } else {\n      let releases = [];\n\n      try {\n        releases = await fetchReleases(config, {\n          includePrereleases: allowRc,\n        });\n      } catch (e) {\n        reporter.error(e.message);\n        return;\n      }\n\n      const release = releases.find(release => {\n        // $FlowFixMe\n        return semver.satisfies(release.version, range);\n      });\n\n      if (!release) {\n        throw new Error(`Release not found: ${range}`);\n      }\n\n      const asset = getBundleAsset(release);\n      invariant(asset, 'The bundle asset should exist');\n\n      bundleUrl = asset.browser_download_url;\n      bundleVersion = release.version.version;\n    }\n\n    reporter.log(`Downloading ${chalk.green(bundleUrl)}...`);\n\n    const bundle = await fetchBundle(config, bundleUrl);\n\n    const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-${bundleVersion}.cjs`);\n    reporter.log(`Saving it into ${chalk.magenta(yarnPath)}...`);\n    await fs.mkdirp(path.dirname(yarnPath));\n    await fs.writeFile(yarnPath, bundle);\n    await fs.chmod(yarnPath, 0o755);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/cli/commands/policies.js#L126-L162","documentation":"`yarn policies set-version <range>` fetches the list of yarn releases and finds one whose version satisfies the given semver range (policies.js:138-141). If none satisfies, it throws a plain `Error(\"Release not found: <range>\")`. This is a runtime Error, not a MessageError, so it escapes without yarn's reporter formatting.","triggerScenarios":"Running `yarn policies set-version 99.0.0`, a typo'd tag, or a range that matches no published yarn release; requesting a pre-release without the allow-RC flag (so pre-releases are excluded from the fetched list).","commonSituations":"Asking for a version that doesn't exist; using a tag other than the special-cased ones (latest/nightly/berry/v2) that resolves to nothing; offline/partial release list due to a network hiccup.","solutions":["Use a known version or tag, e.g. `yarn policies set-version 1.22.19` or `latest`.","If you want a release candidate, enable the RC-allowing flag so pre-releases are included.","Double-check the version exists at the yarn releases feed before pinning.","If it failed mid-network-error, note the prior try/catch at policies.js:129-136 reports fetch errors separately; re-run once connectivity is stable."],"exampleFix":"# before\n$ yarn policies set-version 99.0.0   # Release not found: 99.0.0\n# after\n$ yarn policies set-version 1.22.19","handlingStrategy":"validation","validationCode":"const semver = require('semver');\nasync function pickRelease(fetchReleases, range, {allowRc} = {}) {\n  const releases = await fetchReleases({includePrereleases: !!allowRc});\n  const release = releases.find(r => semver.satisfies(r.version, range));\n  if (!release) throw new Error(`Release not found: ${range}`);\n  return release;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runYarn(['policies', 'set-version', range]);\n} catch (e) {\n  if (/Release not found/.test(e.message)) {\n    console.error(`No yarn release matches '${range}'. Use 'latest' or a real version.`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Prefer the special tags (latest, berry, nightly) or a concrete existing version.","Enable RC inclusion when targeting pre-release versions.","Verify the version exists in the releases feed before pinning."],"tags":["cli","policies","semver","version","self-update"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}