{"record":{"id":"ee30371768718ae9","repo":"angular/components","slug":"no-data-could-be-found-for-target-version-versi","errorCode":null,"errorMessage":"No data could be found for target version: ${version}","messagePattern":"No data could be found for target version: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cdk/schematics/update-tool/version-changes.ts","lineNumber":34,"sourceCode":"  pr: string;\n  changes: T[];\n};\n\n/** Conditional type that unwraps the value of a version changes type. */\nexport type ValueOfChanges<T> = T extends VersionChanges<infer X> ? X : null;\n\n/**\n * Gets the changes for a given target version from the specified version changes object.\n *\n * For readability and a good overview of breaking changes, the version change data always\n * includes the related Pull Request link. Since this data is not needed when performing the\n * upgrade, this unused data can be removed and the changes data can be flattened into an\n * easy iterable array.\n */\nexport function getChangesForTarget<T>(target: TargetVersion, data: VersionChanges<T>): T[] {\n  if (!data) {\n    const version = (TargetVersion as Record<string, string>)[target];\n    throw new Error(`No data could be found for target version: ${version}`);\n  }\n\n  return (data[target] || []).reduce((result, prData) => result.concat(prData.changes), [] as T[]);\n}\n\n/**\n * Gets all changes from the specified version changes object. This is helpful in case a migration\n * rule does not distinguish data based on the target version, but for readability the\n * upgrade data is separated for each target version.\n */\nexport function getAllChanges<T>(data: VersionChanges<T>): T[] {\n  return Object.keys(data)\n    .map(targetVersion => getChangesForTarget(targetVersion as TargetVersion, data))\n    .reduce((result, versionData) => result.concat(versionData), []);\n}\n","sourceCodeStart":16,"sourceCodeEnd":50,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/cdk/schematics/update-tool/version-changes.ts#L16-L50","documentation":"getChangesForTarget looks up migration data for a TargetVersion (e.g. v17) in a VersionChanges object. If the whole data object is undefined/null, it derives a version name from TargetVersion and throws a generic Error. This guards against an internal data-table bug: a migration running without its bundled upgrade dataset.","triggerScenarios":"Calling getChangesForTarget(target, data) where the `data` argument is falsy — i.e. an update-tool migration module invokes it with a missing/unloaded dataset, typically a wiring bug in the schematics (null data passed instead of the generated version-changes collection).","commonSituations":"Running an ng update migration whose data file failed to be included/generated, a partially updated @angular/cdk+material package, or a custom schematic reusing getChangesForTarget with a dataset for versions the TargetVersion enum doesn't cover. Per the doc comment, old datasets are removed after each upgrade cycle, so a mismatched version can hit missing data.","solutions":["Ensure @angular/cdk and @angular/material are updated to matching versions (ng update @angular/material) so the migration and its data ship together.","Retry the migration; if it persists, file a bug — passing null data is an internal schematics bug, not user error.","If you maintain a custom schematic calling this, pass the actual generated VersionChanges object, not null/undefined, and confirm the target version exists in the dataset."],"exampleFix":"// before\nconst changes = getChangesForTarget(targetVersion, null);\n// after\nconst changes = data ? getChangesForTarget(targetVersion, data) : [];","handlingStrategy":"try-catch","validationCode":"if (!data || Object.keys(data).length === 0) {\n  throw new Error(`No migration data available for this @angular/* version; ensure cdk/material versions match`);\n}","typeGuard":"function hasVersionData<T>(data: VersionChanges<T> | null | undefined): data is VersionChanges<T> {\n  return !!data && typeof data === 'object' && Object.keys(data).length > 0;\n}","tryCatchPattern":"try {\n  const changes = getChangesForTarget(target, data);\n} catch (e) {\n  if (/No data could be found for target version/.test(e.message)) {\n    console.error('Migration data missing; reinstall matching @angular/cdk + @angular/material versions and retry ng update.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Update @angular/cdk and @angular/material together via ng update so migrations and data stay in sync.","Don't mix @angular/* package versions across major releases.","If writing custom schematics, always pass the generated dataset, never null."],"tags":["angular","schematics","migration","missing-data"],"backgroundTag":"missing-migration-data","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}