Skip to content
Latchkey

Turborepo globalDependencies not hashed (stale) in CI

A root-level file that affects every build (a shared tsconfig, lockfile, or .env) changed, but it is not in globalDependencies, so no task hash changed and all tasks replayed stale cache.

What this error means

After editing a root config, every package still reports a cache hit and ships unchanged output, even though the shared file changed.

turbo
web:build: cache hit, replaying logs
api:build: cache hit, replaying logs
# root tsconfig.base.json changed but nothing rebuilt

Common causes

Root file not in globalDependencies

Files outside any package are only hashed if listed in globalDependencies, so changes to them are invisible to task hashes.

Lockfile excluded

Dependency changes via the lockfile are not reflected unless the lockfile is part of the global hash.

Global env vars not declared

Build-affecting env not in globalEnv leaves the hash unchanged across values.

How to fix it

Add root files to globalDependencies

  1. List shared configs and the lockfile so all task hashes depend on them.
turbo.json
{
  "globalDependencies": ["tsconfig.base.json", "pnpm-lock.yaml"],
  "globalEnv": ["NODE_ENV"]
}

Verify hashes change

  1. Edit the global file and confirm dry-run shows new hashes.
Terminal
turbo run build --dry-run=json | jq '.tasks[].hash'

How to prevent it

  • List every cross-cutting root file and env var in globalDependencies and globalEnv so shared changes always invalidate the cache.

Frequently asked questions

What causes ""globalDependencies not hashed""?
Files outside any package are only hashed if listed in globalDependencies, so changes to them are invisible to task hashes.
How do I fix "globalDependencies not hashed"?
Add root files to globalDependencies

Related guides

References

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