skills/turborepo/references/caching/gotchas.md
--summarizeGenerates a JSON file with all hash inputs. Compare two runs to find differences.
turbo build --summarize
# Creates .turbo/runs/<run-id>.json
The summary includes:
Comparing runs:
# Run twice, compare the summaries
diff .turbo/runs/<first-run>.json .turbo/runs/<second-run>.json
--dry / --dry=jsonSee what would run without executing anything:
turbo build --dry
turbo build --dry=json # machine-readable output
Shows cache status for each task without running them.
--forceSkip reading cache, re-execute all tasks:
turbo build --force
Useful to verify tasks actually work (not just cached results).
Symptom: Task runs when you expected a cache hit.
Check if an env var in the env key changed:
{
"tasks": {
"build": {
"env": ["API_URL", "NODE_ENV"]
}
}
}
Different API_URL between runs = cache miss.
.env files aren't tracked by default. Add to inputs:
{
"tasks": {
"build": {
"inputs": ["$TURBO_DEFAULT$", ".env", ".env.local"]
}
}
}
Or use globalDependencies for repo-wide env files:
{
"globalDependencies": [".env"]
}
With futureFlags.globalConfiguration, use global.inputs instead. The key difference: global.inputs files are folded into each task's hash individually (not the global hash), so tasks can exclude specific files with negation globs.
{
"futureFlags": { "globalConfiguration": true },
"global": {
"inputs": [".env"]
}
}
Installing/updating packages changes the global hash.
Any file in the package (or in inputs) triggers a miss.
Config changes invalidate the global hash.
Symptom: Cached output is stale/wrong.
Task uses an env var not listed in env:
// build.js
const apiUrl = process.env.API_URL; // not tracked!
Fix: add to task config:
{
"tasks": {
"build": {
"env": ["API_URL"]
}
}
}
Task reads a file outside default inputs:
{
"tasks": {
"build": {
"inputs": [
"$TURBO_DEFAULT$",
"../../shared-config.json" // file outside package
]
}
}
}
# Only show output for cache misses
turbo build --output-logs=new-only
# Show output for everything (debugging)
turbo build --output-logs=full
# See why tasks are running
turbo build --verbosity=2
globalConfiguration EnabledWhen futureFlags.globalConfiguration is on, global.inputs files appear in per-task hash inputs (not the global hash). If you're getting unexpected cache misses:
--summarize output — global input files will show up in the task inputs section, not the global hash sectioninputsglobalConfiguration flag itself invalidates all caches (the flag value is part of the global hash)If you're getting unexpected cache hits after changing a global input file, the task may be excluding that file with a negation glob. Check the task's inputs for !$TURBO_ROOT$/... patterns.
Cache miss when expected hit:
--summarize, compare with previous run--dry=jsonCache hit when expected miss:
env arrayinputs array