Skip to content
Latchkey

Turborepo "unable to calculate hash" in CI

turbo hashes task inputs to decide cache hits, and it relies on git to enumerate files fast. When git is missing, the checkout is unusual, or an input path is outside the workspace, turbo cannot compute the hash and the task fails.

What this error means

turbo fails with "unable to calculate hash" or "could not calculate file hash for ...", often mentioning a git or file access problem.

Turborepo
x unable to calculate file hash
  could not read file ...: git ls-tree failed

Common causes

git is unavailable or the checkout is unusual

turbo uses git to hash inputs. A missing git binary, a detached or partial checkout, or a submodule quirk breaks hashing.

An input path resolves outside the workspace

A globalDependencies or inputs glob pointing outside the repo cannot be hashed.

How to fix it

Ensure a normal git checkout

  1. Use actions/checkout so the repo is a real git working tree.
  2. Avoid manual tarball checkouts that leave no .git.
  3. If you filter by affected, use fetch-depth: 0 so refs exist.
.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Keep input globs inside the workspace

Point inputs and globalDependencies at paths within the repo so every input is hashable.

turbo.json
{
  "globalDependencies": ["tsconfig.base.json", ".env.example"]
}

How to prevent it

  • Check out with git so turbo can hash via git.
  • Keep inputs/globalDependencies inside the workspace.
  • Use fetch-depth: 0 when combining with affected filters.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →