angular/angular-cli · warning
Failed to look up hash of most recent commit, continuing a
Error message
Failed to look up hash of most recent commit, continuing anyways.
What it means
After a migration step is committed to git, the Angular CLI tries to read the new commit's hash to log it. If the hash lookup fails (e.g. unusual git state), the CLI warns that it could not read the hash but continues, since the commit itself succeeded and nothing blocks the update.
Source
Thrown at packages/angular/cli/src/commands/update/utilities/migration.ts:304
createCommit(message);
} catch (err) {
logger.error(
`Failed to commit update (${message}):\n${(err as SpawnSyncReturns<string>).stderr}`,
);
return false;
}
// Notify user of the commit.
const hash = findCurrentGitSha();
const shortMessage = message.split('\n')[0];
if (hash) {
logger.info(` Committed migration step (${getShortHash(hash)}): ${shortMessage}.`);
} else {
// Commit was successful, but reading the hash was not. Something weird happened,
// but nothing that would stop the update. Just log the weirdness and continue.
logger.info(` Committed migration step: ${shortMessage}.`);
logger.warn(' Failed to look up hash of most recent commit, continuing anyways.');
}
return true;
}
async function getOptionalMigrationsToRun(
logger: logging.Logger,
optionalMigrations: MigrationSchematicDescription[],
packageName: string,
): Promise<MigrationSchematicDescription[] | undefined> {
const numberOfMigrations = optionalMigrations.length;
logger.info(
`This package has ${numberOfMigrations} optional migration${
numberOfMigrations > 1 ? 's' : ''
} that can be executed.`,
);
if (!isTTY()) {View on GitHub (pinned to bb72145f9a)
Solutions
- No action strictly required — the migration step was committed and the update continues; this is informational.
- Verify the migration commits exist with `git log` and check that `git rev-parse HEAD` works in the repo.
- Temporarily disable git hooks (e.g. `HUSKY=0` or `--no-verify` behavior) and re-run `ng update` if hashes are repeatedly unreadable.
Defensive patterns
Strategy: fallback
Validate before calling
// before ng update git rev-parse HEAD && git status --porcelain # ensure repo is healthy and clean git log -1 --format=%H # confirm hash lookup works in this repo
Prevention
- Run `ng update` in a clean, healthy git repo (no hooks rewriting commits).
- Disable commit hooks (husky/lint-staged) during migrations.
- After update, verify migration commits exist via `git log`.
When it happens
Trigger: Running `ng update` with migrations; `commitChanges` performs `git commit` successfully but the subsequent hash lookup (e.g. `git rev-parse`) returns no hash — typically due to a non-standard git repo, git hooks modifying the commit, or a git version/environment quirk.
Common situations: Updating Angular packages in workspaces with git hooks (husky/lint-staged) that amend commits, shallow or worktree clones, or repos where git output parsing fails.
Related errors
- Repository is not clean. Update changes will be mixed with p
- The installed Angular CLI version is outdated. Installing a
- Repository is not clean. Please commit or stash any changes
- An unexpected error happened; could not determine version fo
- An unexpected error happened; package ${name} has no version
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/75066528c8abc332.
Report an issue: GitHub.