angular/components · error · Error

No data could be found for target version: ${version}

Error message

No data could be found for target version: ${version}

What it means

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.

Source

Thrown at src/cdk/schematics/update-tool/version-changes.ts:34

  pr: string;
  changes: T[];
};

/** Conditional type that unwraps the value of a version changes type. */
export type ValueOfChanges<T> = T extends VersionChanges<infer X> ? X : null;

/**
 * Gets the changes for a given target version from the specified version changes object.
 *
 * For readability and a good overview of breaking changes, the version change data always
 * includes the related Pull Request link. Since this data is not needed when performing the
 * upgrade, this unused data can be removed and the changes data can be flattened into an
 * easy iterable array.
 */
export function getChangesForTarget<T>(target: TargetVersion, data: VersionChanges<T>): T[] {
  if (!data) {
    const version = (TargetVersion as Record<string, string>)[target];
    throw new Error(`No data could be found for target version: ${version}`);
  }

  return (data[target] || []).reduce((result, prData) => result.concat(prData.changes), [] as T[]);
}

/**
 * Gets all changes from the specified version changes object. This is helpful in case a migration
 * rule does not distinguish data based on the target version, but for readability the
 * upgrade data is separated for each target version.
 */
export function getAllChanges<T>(data: VersionChanges<T>): T[] {
  return Object.keys(data)
    .map(targetVersion => getChangesForTarget(targetVersion as TargetVersion, data))
    .reduce((result, versionData) => result.concat(versionData), []);
}

View on GitHub (pinned to 0411926e7d)

Solutions

  1. Ensure @angular/cdk and @angular/material are updated to matching versions (ng update @angular/material) so the migration and its data ship together.
  2. Retry the migration; if it persists, file a bug — passing null data is an internal schematics bug, not user error.
  3. 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.

Example fix

// before
const changes = getChangesForTarget(targetVersion, null);
// after
const changes = data ? getChangesForTarget(targetVersion, data) : [];
Defensive patterns

Strategy: try-catch

Validate before calling

if (!data || Object.keys(data).length === 0) {
  throw new Error(`No migration data available for this @angular/* version; ensure cdk/material versions match`);
}

Type guard

function hasVersionData<T>(data: VersionChanges<T> | null | undefined): data is VersionChanges<T> {
  return !!data && typeof data === 'object' && Object.keys(data).length > 0;
}

Try / catch

try {
  const changes = getChangesForTarget(target, data);
} catch (e) {
  if (/No data could be found for target version/.test(e.message)) {
    console.error('Migration data missing; reinstall matching @angular/cdk + @angular/material versions and retry ng update.');
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of angular/components@0411926e7d (2026-08-31). Data as JSON: /api/errors/ee30371768718ae9. Report an issue: GitHub.