Skip to content
Latchkey

Chromatic shallow clone: baseline / ancestor not found in CI

Chromatic uses git history to find the baseline build to compare against. The default CI checkout is shallow (depth 1), so Chromatic cannot walk back to the ancestor commit and either treats everything as new or fails baseline detection.

What this error means

Chromatic reports "Failed to find ancestor build" or captures every story as new on a normal PR. Warnings mention a shallow clone or missing git history.

Chromatic
! Unable to find baseline. This may be because the git history is shallow.
  Run `git fetch --unshallow` or set fetch-depth: 0 in your checkout.

Common causes

Shallow checkout hides the ancestor commit

CI checks out with fetch-depth: 1 by default. Chromatic needs earlier commits to locate the baseline build and cannot with only one commit.

The base branch history is not fetched

Even with some depth, if the base branch commit is not present, Chromatic cannot resolve the baseline.

How to fix it

Fetch full history in the checkout

Set fetch-depth: 0 so Chromatic can walk git history to the baseline.

.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Unshallow if depth cannot be changed

When you cannot change the checkout, unshallow the repo before running Chromatic.

Terminal
git fetch --unshallow || true
npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN

How to prevent it

  • Use fetch-depth: 0 for jobs that run Chromatic.
  • Ensure the base branch commit is present in the checkout.
  • Avoid squashing away the ancestor Chromatic relies on.

Frequently asked questions

What causes "Shallow clone breaks baseline lookup"?
CI checks out with fetch-depth: 1 by default. Chromatic needs earlier commits to locate the baseline build and cannot with only one commit.
How do I fix Shallow clone breaks baseline lookup?
Set fetch-depth: 0 so Chromatic can walk git history to the baseline.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card