PN-CLI-4001 Config file not found | Most prisma-next commands | Run prisma-next init, or pass --config <path>. |
PN-CLI-4002 Contract configuration missing | contract emit, db * | Add contract: { ... } to prisma-next.config.ts. See prisma-next-contract. |
PN-CLI-4003 Contract validation failed | contract emit, db * | Re-run pnpm prisma-next contract emit after fixing the contract source named in where.path. See prisma-next-contract. |
PN-CLI-4005 Database connection is required | db *, migrate, migration status | Pass --db <url> or set db.connection in prisma-next.config.ts. |
PN-CLI-4011 Missing extension packs in config | contract emit (e.g. contract uses pgvector.Vector(...) but config does not list the pgvector pack) | Add the descriptors named in meta.missingExtensionPacks to extensionPacks in prisma-next.config.ts. See prisma-next-contract. |
PN-CLI-4020 Migration planning failed | db init, db update | Inspect meta.conflicts. Recovery is per-conflict — chain to prisma-next-migrations. |
PN-CLI-5002/5003/5004/… Init errors | prisma-next init | Re-run with the missing/invalid flags listed in meta.missingFlags or meta.allowed. |
PN-MIG-2001 Unfilled migration placeholder | node migrations/app/<dir>/migration.ts (self-emit) or migrate | Edit migration.ts, replace the named placeholder("<slot>") with a real query closure, self-emit. See prisma-next-migrations. |
PN-MIG-2002 migration.ts not found | Reading a migration package | Restore from version control or scaffold a fresh package with migration plan. |
PN-MIG-2003 Invalid default export | Loading migration.ts | Use export default class extends Migration { ... } (or factory () => ({ ... })). See prisma-next-migrations. |
PN-MIG-2005 dataTransform contract mismatch | Building a data-transform query plan | Pass the same endContract reference to both dataTransform(endContract, …) and the query-builder context. |
PN-RUN-3001 Database not signed | db verify, runtime startup | DB has no marker yet. Run prisma-next db init --db <url> (baseline empty DB) or db update --db <url> (apply contract directly). |
PN-RUN-3002 Hash mismatch | db verify, runtime startup | Marker disagrees with contract hash. Either migrate forward (migrate / db update), or — if the DB is correct after a manual fix-up — db sign. See prisma-next-migrations. |
PN-RUN-3003 Target mismatch | Runtime startup | Contract target ≠ config target; align them (see meta.expected / meta.actual). |
PN-RUN-3004 Schema verification failed | db verify (full mode) | Inspect meta.verificationResult. Run db update to reconcile, or adjust contract. |
PN-RUN-3010 Schema verification failed (CLI surface) | db verify schema-only | Same as 3004. |
PN-RUN-3020 Migration runner failed | migrate, db update, db init | Inspect meta for the conflict; reconcile schema drift, then re-run. Previously applied migrations are preserved. |
PN-RUN-3030 Destructive changes require confirmation | db update (interactive prompt fires; non-interactive returns this code) | Re-run with -y (or --yes) to apply, or --dry-run to preview. Only db update has this flow — migrate does not gate destructive ops on a flag. |
PN-RUN-3000 (wrapper) | migrate, others wrapping MigrationToolsError | Read meta.code. Cases: MIGRATION.HASH_MISMATCH (re-emit: node migrations/app/<dir>/migration.ts); MIGRATION.AMBIGUOUS_TARGET (concurrent migrations — prisma-next-migration-review); MIGRATION.STALE_CONTRACT_BOOKENDS (re-run migration plan); MIGRATION.NO_INVARIANT_PATH / MIGRATION.UNKNOWN_INVARIANT (prisma-next-migration-review); MIGRATION.PATH_UNREACHABLE / MIGRATION.MARKER_MISMATCH (run migrate --show --db $URL to inspect the path, then migration plan --from <from> --to <target> or migration list to audit the graph — see prisma-next-migration-review). |
PN-SCHEMA-0001 | db verify schema check | Live schema does not satisfy contract. meta.verificationResult has the diff. Run db update or adjust the contract. |
MIGRATION.UP_TO_DATE / .DATABASE_BEHIND | migration status info diagnostics | Informational; exit 0. See prisma-next-migration-review. |
MIGRATION.MISSING_INVARIANTS | migration status info diagnostic | The live marker reached the destination hash structurally but doesn't carry all invariants the target ref requires. Run migrate --to <name> --db $URL to take a path that covers the missing invariants. See prisma-next-migration-review. |
MIGRATION.NO_MARKER / .MARKER_NOT_IN_HISTORY / .DIVERGED / CONTRACT.AHEAD / CONTRACT.UNREADABLE | migration status warn diagnostics (exit 0; CI gates parse --json) | Read severity and code. prisma-next-migration-review covers the diamond/diverged/marker-out-of-history flows. |
BUDGET.ROWS_EXCEEDED / BUDGET.TIME_EXCEEDED | Runtime, when the budgets middleware is active | Tune budgets({ maxRows, maxLatencyMs, ... }) or rewrite the query. See prisma-next-runtime. |
LINT.SELECT_STAR / LINT.NO_LIMIT / LINT.DELETE_WITHOUT_WHERE / LINT.UPDATE_WITHOUT_WHERE / LINT.READ_ONLY_MUTATION | Runtime, when the lints middleware is active | Fix the query (add a WHERE / LIMIT / explicit columns), or relax the lint config. See prisma-next-runtime. |
PLAN.HASH_MISMATCH | Runtime, executing a precompiled plan | The contract the plan was built against does not match the runtime contract. Re-emit, rebuild, redeploy. |
CONTRACT.MARKER_MISSING / CONTRACT.MARKER_MISMATCH | Runtime, marker check before executing | Same family as PN-RUN-3001 / PN-RUN-3002 but raised in-process by the runtime rather than a CLI. Recovery is the same. |
RUNTIME.ABORTED (details.phase = encode|decode|stream|beforeExecute|afterExecute|onRow) | Runtime, when an AbortSignal fires mid-execute | Cancellation, not a bug; surface to the caller. |
SqlQueryError (no PN- code) | Raw-SQL paths surfacing a driver error | Inspect sqlState + constraint + table + column. Postgres 23505 = unique violation, 23503 = foreign-key violation, etc. Fix the data or the schema. |
TypeScript error mentioning a capability (e.g. returning() not on the type, include of a many-relation off a many-load) | Authoring-time, before any envelope fires | Capability gates are declared in the contract (capabilities block, namespaced by target/family), not in prisma-next.config.ts. Route to prisma-next-contract for capability declaration and to prisma-next-queries for which method gates on which capability. Re-emit (pnpm prisma-next contract emit) after enabling. |
TypeScript error mentioning a missing field/method on db.orm.<Model> or a stale Contract shape | Authoring-time | Re-emit (pnpm prisma-next contract emit); confirm db.ts instantiates with postgres<Contract, TypeMaps>(...) (the type parameters propagate the contract types). See prisma-next-runtime and prisma-next-contract. |