{"record":{"id":"c81b4a107d84ae09","repo":"vercel/turborepo","slug":"turbo-to-does-not-exist","errorCode":null,"errorMessage":"turbo@${to} does not exist","messagePattern":"turbo@(.+?) does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/turbo-codemod/src/commands/migrate/steps/get-latest-version.ts","lineNumber":42,"sourceCode":"    throw new Error(`Unable to fetch the latest version of ${packageName}`);\n  }\n}\n\nexport async function getLatestVersion({\n  to\n}: MigrateCommandOptions): Promise<string | undefined> {\n  const packageDetails = await getPackageDetails({ packageName: \"turbo\" });\n  const { \"dist-tags\": tags, versions } = packageDetails;\n\n  if (to) {\n    // If 'to' is a dist-tag (e.g. \"latest\", \"canary\"), resolve to the concrete version\n    if (tags[to]) {\n      return tags[to];\n    }\n    if (to in versions) {\n      return to;\n    }\n    throw new Error(`turbo@${to} does not exist`);\n  }\n\n  return tags.latest;\n}\n","sourceCodeStart":24,"sourceCodeEnd":47,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/packages/turbo-codemod/src/commands/migrate/steps/get-latest-version.ts#L24-L47","documentation":"When you pass --to to turbo-codemod migrate, getLatestVersion resolves it against the npm registry. It first checks dist-tags such as latest or canary, then the published version list. It throws this Error when the value matches neither, so the requested turbo version does not exist.","triggerScenarios":"Running migrate with --to set to a version turbo never published, for example 99.0.0, or to a dist-tag name that does not exist. The fetched metadata contains neither the tag nor the version in its keys.","commonSituations":"Typos in the version string, such as 2.3.10 instead of 2.3.1. Guessing at a version that was never released. Using a custom registry mirror that is missing published versions. Passing a branch or commit name instead of a version.","solutions":["List available versions and tags: npm view turbo versions --json and npm view turbo dist-tags --json","Re-run migrate with an exact published version or a valid dist-tag such as latest or canary","If you use a registry mirror, sync it or point npm_config_registry at the official registry","Omit --to to let the codemod use the latest dist-tag"],"exampleFix":"# before\nnpm exec @turbo/codemod migrate --to 2.3.10\n# after (after confirming the version exists)\nnpm exec @turbo/codemod migrate --to 2.3.1","handlingStrategy":"validation","validationCode":"// confirm --to exists as a dist-tag or version before invoking the codemod\nimport { execSync } from \"node:child_process\";\n\nfunction resolveTurboTarget(to: string): string {\n  const tags = JSON.parse(execSync(\"npm view turbo dist-tags --json\").toString());\n  if (tags[to]) return tags[to];\n  const versions = JSON.parse(execSync(\"npm view turbo versions --json\").toString());\n  if (versions.includes(to)) return to;\n  throw new Error(`turbo@${to} does not exist`);\n}","typeGuard":"function looksLikePublishedVersion(v: string, published: string[]): boolean {\n  return published.includes(v);\n}","tryCatchPattern":null,"preventionTips":["Check npm view turbo versions --json before passing --to","Prefer dist-tags such as latest or canary over hardcoded versions","Automate version resolution from dist-tags in migration scripts"],"tags":["turbo-codemod","version","npm","migrate","validation"],"backgroundTag":"npm-version-not-found","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}