{"record":{"id":"e4449998b10cf013","repo":"vercel/turborepo","slug":"could-not-find-turbo-in-catalogname-catalog","errorCode":null,"errorMessage":"Could not find turbo in ${catalogName ? `catalog \"${catalogName}\"` : \"default catalog\"} in ${catalogFile}","messagePattern":"Could not find turbo in (.+?)\"` : \"default catalog\"\\} in (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/turbo-codemod/src/commands/migrate/steps/update-catalog.ts","lineNumber":103,"sourceCode":"}: {\n  catalogInfo: CatalogInfo;\n  version: string;\n}): boolean {\n  const { catalogFile, catalogName } = catalogInfo;\n  const content = fs.readFileSync(catalogFile, \"utf8\");\n  const doc = parseDocument(content);\n\n  // Path differs for default vs named catalogs:\n  //   default: catalog.turbo\n  //   named:   catalogs.<name>.turbo\n  const yamlPath =\n    catalogName === null\n      ? [\"catalog\", \"turbo\"]\n      : [\"catalogs\", catalogName, \"turbo\"];\n\n  const currentValue = doc.getIn(yamlPath) as string | undefined;\n  if (!currentValue) {\n    logger.warn(\n      `Could not find turbo in ${catalogName ? `catalog \"${catalogName}\"` : \"default catalog\"} in ${catalogFile}`\n    );\n    return false;\n  }\n\n  // Preserve the version range prefix (^, ~, >=, etc.)\n  const prefixMatch = currentValue.match(/^([^\\d]*)/);\n  const prefix = prefixMatch ? prefixMatch[1] : \"^\";\n  const newValue = `${prefix}${version}`;\n\n  if (currentValue === newValue) {\n    return false;\n  }\n\n  doc.setIn(yamlPath, newValue);\n  fs.writeFileSync(catalogFile, doc.toString());\n\n  return true;","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/packages/turbo-codemod/src/commands/migrate/steps/update-catalog.ts#L85-L121","documentation":"In turbo-codemod's update-catalog step, after locating the catalog file it parses the YAML and reads `catalog.turbo` for a default reference or `catalogs.<name>.turbo` for a named one. If that key is absent the step warns and returns false, leaving the catalog's turbo entry unmodified — this migration step simply does not apply.","triggerScenarios":"A package.json says `\"turbo\": \"catalog:\"` but the YAML `catalog:` block has no `turbo` key; or the specifier is `catalog:foo` while `catalogs.foo` exists but lacks a `turbo` entry (currentValue from doc.getIn is undefined).","commonSituations":"Catalog defined for other dependencies but turbo not yet added; a named-catalog typo (`catalog:web` vs a `catalogs: webx` key); partial catalog adoption across the monorepo.","solutions":["Add a turbo entry to the catalog in pnpm-workspace.yaml and re-run the codemod","Fix the named catalog reference so it matches an existing `catalogs.<name>` block","Check for typos between the specifier suffix and the YAML key"],"exampleFix":"# before: pnpm-workspace.yaml\ncatalog:\n  next: '^15.1.0'\n# package.json: \"turbo\": \"catalog:\n\n# after: pnpm-workspace.yaml\ncatalog:\n  next: '^15.1.0'\n  turbo: '^2.0.0'","handlingStrategy":"type-guard","validationCode":"import { parseDocument } from 'yaml';\n\nconst doc = parseDocument(fs.readFileSync(catalogFile, 'utf8'));\nconst turbo = catalogName === null\n  ? doc.getIn(['catalog', 'turbo'])\n  : doc.getIn(['catalogs', catalogName, 'turbo']);\nif (!turbo) throw new Error('add a turbo entry to the catalog before migrating');","typeGuard":"type Workspace = { catalog?: Record<string, string>; catalogs?: Record<string, Record<string, string>> };\n\nfunction hasTurboInCatalog(ws: unknown, name: string | null): ws is Workspace {\n  if (typeof ws !== 'object' || ws === null) return false;\n  const w = ws as Record<string, unknown>;\n  return name === null\n    ? Boolean((w.catalog as Record<string, string> | undefined)?.turbo)\n    : Boolean((w.catalogs as Record<string, Record<string, string>> | undefined)?.[name]?.turbo);\n}","tryCatchPattern":null,"preventionTips":["Keep a turbo entry present in every catalog that packages reference","Mirror specifier names exactly: `catalog:web` requires `catalogs.web.turbo` to exist","Re-run the codemod after fixing the YAML and confirm it now applies the version update"],"tags":["codemod","pnpm","catalog","migration"],"backgroundTag":"missing-config-key","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}