Skip to content
GitHubBlueskydev.toRSS

05Cache results

Find why a task missed the cache

A task ran when you expected a skip. Ask vx why:

Terminal window
vx why @demo/ui#build
Read

You edited packages/ui/src/index.ts and built. vx why compares this run with the one before:

Terminal window
Why @demo/ui#build
run 01a209cb-579f-71e1-b5ba-9a1a6018b8c4
this run 2026-11-23T19:04:10.943Z · success · executed · key da8bbb5e7693ba71
previous 2026-11-23T19:04:10.632Z · success · executed · key 323a4fbfdde6fd8e
verdict cache key changed: file packages/ui/src/index.ts
What changed 1 of 4
change kind name before → after
changed file packages/ui/src/index.ts d00491fd7e5bb6fa28c517a0bb32b8b506539d4d → 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f
What to do
file an edit re-runs by design; a file the task does not read belongs out of inputs.files

Four parts, top to bottom:

Part Tells you
Why both runs, each with its result and key
verdict the answer in one line: what moved
What changed each moved part, before and after; 1 of 4 means 1 of the key’s 4 parts moved
What to do whether this is expected, and how to fix it if not

The keys differ and the verdict names the file. That run was expected: you edited an input.

You can now find the one file that made a task run.

@demo/web uses @demo/ui, so its build depends on @demo/ui#build. The same edit ran both:

editedupstreamsrc/index.ts@demo/ui@demo/ui#buildnew key@demo/web#buildnew keyeditedupstreamsrc/index.ts@demo/ui@demo/ui#buildnew key@demo/web#buildnew key
One edit, two re-runs: a new key travels to every task that depends on it.
Terminal window
vx why @demo/web#build
Terminal window
Why @demo/web#build
run 01a209cb-579f-71e1-b5ba-9a1a6018b8c4
this run 2026-11-23T19:04:10.990Z · success · executed · key 4b39fc8fe6cb1046
previous 2026-11-23T19:04:10.690Z · success · executed · key 5dffef39d12efd08
verdict cache key changed: upstream @demo/ui#build
What changed 1 of 5
change kind name before → after
changed upstream @demo/ui#build 323a4fbfdde6fd8e → da8bbb5e7693ba71
Root cause
@demo/web#build ← @demo/ui#build ← file packages/ui/src/index.ts
What to do
file an edit re-runs by design; a file the task does not read belongs out of inputs.files

The verdict says upstream @demo/ui#build: a task it depends on got a new key. Root cause follows the tasks back to the file you touched.

You can now trace a re-run through any number of tasks to the edit that started it.

The kind column says what moved. Step through the three you meet most:

Three reasons a task runs

file: an input changed

Terminal window
verdict cache key changed: file packages/ui/src/index.ts

The edit above. What to do says an edit runs by design. If the task does not read that file, take it out of inputs.files.

env: a variable changed

@demo/web#build lists MODE in inputs.env. The last two runs had MODE=staging, then MODE=production:

Terminal window
$ vx why @demo/web#build
Why @demo/web#build
run 01a209c1-1e0f-76ba-8830-5c5ac8b5bb21
this run 2026-11-23T18:53:00.858Z · success · executed · key dacc0c92098b463a
previous 2026-11-23T18:53:00.245Z · success · executed · key f019b0fdc69a5ac5
verdict cache key changed: env MODE
What changed 1 of 9
change kind name before → after
changed env MODE bc7ff980bab9217c → 11bb989f56d9506d
What to do
env the variable's value moved; one the task does not read belongs out of inputs.env

vx shows a hash of each value, never the value itself.

config: the task itself changed

The command in vx.config.ts became vite build --minify false:

Terminal window
$ vx why @demo/ui#build
Why @demo/ui#build
run 01a209c1-2257-776d-aec6-52a982c786aa
this run 2026-11-23T18:53:01.941Z · success · executed · key 498a9bc9f7d6cf6d
previous 2026-11-23T18:53:00.845Z · cache-hit · up-to-date · key 69575ae4d3029055
verdict cache key changed: config
What changed 1 of 7
change kind name before → after
changed config config e47ffa458aad2c6b → b5cea63a07bf16fc
What to do
config the task's evaluated config changed (its vx.config or a file it imports); `vx show @demo/ui#build` prints it as it is now

vx show @demo/ui#build prints the task’s current config.

Check yourself You add README.md to packages/ui and build. vx prints up-to-date. What does vx why say?

cache key unchanged — this run was served from cache, nothing re-ran. README.md is not in inputs.files, so the key did not move.

You can now tell a file, a variable and a config change apart at a glance.

Make an edit, press Run, and read the reason vx gives for each task:

Run 2: 4 tasks, 4 up to date.

First run: the cache is empty

  1. @demo/ui#buildb16c73d4cache miss · ran

    previous: none, first recorded run of this task

    Nothing stored for this key yet, so the task runs and vx stores its result.

  2. @demo/web#buildad572154cache miss · ran

    previous: none, first recorded run of this task

    Nothing stored for this key yet, so the task runs and vx stores its result.

  3. @demo/admin#build99bc8534cache miss · ran

    previous: none, first recorded run of this task

    Nothing stored for this key yet, so the task runs and vx stores its result.

  4. @demo/api#build7d3064decache miss · ran

    previous: none, first recorded run of this task

    Nothing stored for this key yet, so the task runs and vx stores its result.

$ vx run build --all

┌─ @demo/ui#build > $ vite build
✓ built in 416ms
└─ @demo/ui#build ── (640ms) success

┌─ @demo/web#build > $ vite build
✓ built in 533ms
└─ @demo/web#build ── (820ms) success

┌─ @demo/admin#build > $ vite build
✓ built in 462ms
└─ @demo/admin#build ── (710ms) success

┌─ @demo/api#build > $ vite build
✓ built in 267ms
└─ @demo/api#build ── (410ms) success

  tasks   4 success 4 total
  cache   4 miss

Second run: nothing changed

  1. @demo/ui#buildb16c73d4up to date

    cache key unchanged — this run was served from cache, nothing re-ran

    Same key, and dist/ is already in place. Nothing runs, nothing is copied.

  2. @demo/web#buildad572154up to date

    cache key unchanged — this run was served from cache, nothing re-ran

    Same key, and dist/ is already in place. Nothing runs, nothing is copied.

  3. @demo/admin#build99bc8534up to date

    cache key unchanged — this run was served from cache, nothing re-ran

    Same key, and dist/ is already in place. Nothing runs, nothing is copied.

  4. @demo/api#build7d3064deup to date

    cache key unchanged — this run was served from cache, nothing re-ran

    Same key, and dist/ is already in place. Nothing runs, nothing is copied.

$ vx run build --all

┌─ @demo/ui#build > up-to-date • b16c73d4
✓ built in 416ms
└─ @demo/ui#build ── (5ms) up-to-date

┌─ @demo/web#build > up-to-date • ad572154
✓ built in 533ms
└─ @demo/web#build ── (5ms) up-to-date

┌─ @demo/admin#build > up-to-date • 99bc8534
✓ built in 462ms
└─ @demo/admin#build ── (5ms) up-to-date

┌─ @demo/api#build > up-to-date • 7d3064de
✓ built in 267ms
└─ @demo/api#build ── (5ms) up-to-date

  tasks   4 success 4 total
  cache   4 up-to-date
What each task reads
taskinputs.filesinputs.envdependsOnoutputs.files
@demo/ui#buildsrc/**, vite.config.ts—^build (none)dist/**
@demo/web#buildsrc/**, vite.config.tsMODE^build (@demo/ui#build)dist/**
@demo/admin#buildsrc/**, vite.config.ts—^build (@demo/ui#build)dist/**
@demo/api#buildsrc/**, vite.config.ts—^build (none)dist/**
@demo/ui#testsrc/**—^build (none)—
@demo/web#testsrc/**—^build (@demo/ui#build)—
@demo/admin#testsrc/**—^build (@demo/ui#build)—
@demo/api#testsrc/**—^build (none)—
@demo/ui#lintsrc/**———
@demo/web#lintsrc/**———
@demo/admin#lintsrc/**———
@demo/api#lintsrc/**———

Every task has cache: true. Git ignores *.log.

You can now predict a hit or a miss before you run.

PatternsCommon cases

The verdict starts never cached. The task, or one it depends on, has no inputs, so each run makes a new key. Add inputs to the task the verdict names.

vx why says the key did not move, so the file you changed is not an input. Add it to inputs.files and run vx lock.

vx last --list lists recent runs. Pass one’s id to compare that run with the one before it:

Terminal window
vx why @demo/ui#build --run 01a209c0-fc0b-7616-8c58-7e50479c4225

--format json prints the same answer as one object:

Terminal window
vx why @demo/web#build --format json
{
"taskId": "@demo/web#build",
"diff": {
"entries": [
{ "kind": "upstream", "name": "@demo/ui#build", "change": "changed", "before": "235118720ed1a79b", "after": "693d3b58e7193bca" }
],
"unchangedCount": 7
},
"roots": [
{
"entries": [{ "kind": "file", "name": "packages/ui/src/index.ts", "change": "changed" }]
}
]
}

Trimmed: the full object also holds both runs’ keys, times and results, and each root’s path of tasks.

You can now fix a task that never caches or one that never runs, and script the answer.

DetailsEvery option and kind
Terminal window
vx why (TASK | PKG#TASK) [--run RUNID] [--format pretty|json] [--cache-dir <path>]
Option Default What it does
TASK or PKG#TASK required the task to explain; build alone means the project in the folder you are in
--run <id> the latest run explain that run instead
--format pretty json for one object
--cache-dir <path> the workspace’s read the cache a run with the same flag used
kind Moved because
file a file in inputs.files or inputs.workspaceFiles changed, appeared or went
linked a symlink among the inputs points somewhere else
env a variable in inputs.env changed
runtime a command in inputs.runtime printed something else
ws-runtime a command in inputs.workspaceRuntime printed something else
upstream a task it depends on got a new key
config the task’s config changed, or a file the config imports
forward the arguments after -- changed
plugin a plugin’s part of the key moved, such as the package’s dependencies in the lockfile
platform the task ran on another platform
format vx itself changed: a new vx version keys every task anew once

vx why reads the run history in .vx/cache. vx cache clean empties it, so vx why has nothing to compare until two more runs.

Every verdict line vx prints: Caching. The command in full: vx why.

NextSandboxing →

Make vx prove a task reads only what its inputs list, so a missed input fails loudly.

Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.