# X_SCAFFOLD_FIRST_RUN_FAILED

## Means

a first-run command failed inside a freshly scaffolded app

## Typical cause

one step of `scripts/scaffold-first-run.ts` exited non-zero — `x db migrate` against the pristine scaffold, then one `x g` per kind in the CLI's own `GENERATORS` registry, then `x db gen` and a second `x db migrate` over what they wrote — or the app has no `x` binary, which is `bun install` never having linked one. It exists because `scaffold-smoke` ran `x new` → `bun install` → `x verify` and nothing else, so three shipped defects sat outside CI: four generators emitting imports that resolve to nothing, a first migration with no snapshot sidecar, and a snapshot the app's own `lint` rejects. Every step runs — four broken generators are four findings in one run. `scripts/scaffold-admin.ts` raises it too: it boots `x dev` in a scaffold, creates, edits and deletes a row through the admin's own forms, and checks a `member` is refused

## Fix

the `fix` is the single command that reproduces that step, verbatim: `cd <app> && <app>/node_modules/.bin/x <args>`. For a missing binary it is `cd <app> && bun install --linker=hoisted`

[CLI and verify](/error-codes#cli-and-verify)
