# Error reference (/docs/orm/reference/error-reference) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. The structured error codes of the Prisma ORM commands, runtime, and extensions, by namespace, with the condition that raises each one. Location: ORM > Reference > Error reference Every user-facing Prisma ORM error is a structured envelope identified by a dotted `NAMESPACE.SUBCODE` code (see [ADR 239](https://github.com/prisma/orm/blob/v8.0.0-rc.25/docs/architecture%20docs/adrs/ADR%20239%20-%20Errors%20are%20structural%20envelopes%20with%20dotted%20namespace%20codes.md) and [Error Handling](https://github.com/prisma/orm/blob/v8.0.0-rc.25/docs/Error%20Handling.md)). This page lists the codes from the Prisma ORM commands, which start with `prisma contract`, `prisma db`, `prisma migration`, and `prisma orm`, and the codes your app can raise at runtime, including from extensions. Every other `prisma` command has its codes on the [CLI error reference](https://www.prisma.io/docs/cli/error-reference). When an error prints a `docsUrl`, that link opens the code's entry on this page, except for some `CLI.*` codes, which the next paragraph describes. This page is generated from the `prisma/orm` repository. One exception: some `CLI.*` codes come from the command-line layer that every `prisma` command runs through, for its arguments, for loading `prisma.config.ts`, for prompts, and for consent. Those are on the [CLI error reference](https://www.prisma.io/docs/cli/error-reference) even when you ran a Prisma ORM command. `CLI.CONFIG_SECTION_INVALID` from `prisma contract emit` is one of them. When a Prisma ORM command raises one of these codes, its `docsUrl` still points to this page, which has no entry for it, so the page opens at the top. The `CLI.*` codes on this page are the ones the Prisma ORM commands raise themselves. If a `CLI.*` code is not on this page, it is on the other. Recognize an error programmatically with `isStructuredError` from your facade package's `utils/structured-error` subpath (for example `@prisma/orm-postgres/utils/structured-error`) and match on `error.code`, never `instanceof`. Envelopes carry `message`, and optionally `why`, `fix`, `where`, `cause`, `docsUrl`, and the structured context each entry below lists as its **Payload**. The payload arrives on `error.meta` when the envelope was built by `structuredError` and on `error.details` when it was built by `runtimeError`; a few codes are raised both ways, so read whichever property the envelope carries. Exit codes (CLI): an expected structured failure exits `2`, a user abort exits `3`, and `1` is reserved for internal errors (bugs). Codes on this page exit `2` unless the entry says otherwise. Some codes are not failures to run at all. `db verify`, `db sign` and `migration check` answer a question about the project, and a bad answer is still an answer: they finish, report their findings as diagnostics on a successful envelope, and exit `4`. Exit `2` is reserved for the cases where those commands could not do the job: an unknown `--space`, a migration reference that resolves to nothing, an unreachable database, a contract that has not been emitted. Every entry whose code can arrive on one of those runs says so and names the command. Each of those commands declares the numbers it can exit with, and its `--help` text spells out what each one means. A command may also **complete with findings**: it ran to its end and has a result to report, and the problems it found ride that result as diagnostics carrying the codes on this page. Those runs exit with a documented per-command code in the `4`–`99` band rather than `2`, and the entry below says so. `prisma orm init` is the case today: its scaffold is on disk whatever happens next, so a failed dependency install or contract emit is a finding on a completed run at exit `4` or `5`. Codes that predate the dotted scheme were renamed at 0.16; the full old→new crosswalk (`PN-DOMAIN-NNNN` → `NAMESPACE.SUBCODE`) is in [ADR 239](https://github.com/prisma/orm/blob/v8.0.0-rc.25/docs/architecture%20docs/adrs/ADR%20239%20-%20Errors%20are%20structural%20envelopes%20with%20dotted%20namespace%20codes.md). Namespaces on this page: - [`CONFIG`](#config): Loading and validating `prisma.config.ts` - [`CLI`](#cli): Command-line argument and invocation errors - [`CONTRACT`](#contract): Contract authoring, emission, validation, and the contract↔database relationship (markers, schema verification) - [`PSL`](#psl): The PSL source text itself (parse, format, interpret), including a Prisma ORM 7 schema read as the contract source - [`ORM`](#orm): ORM client and query-builder DSL API misuse - [`RUNTIME`](#runtime): Query execution and runtime wiring - [`DRIVER`](#driver): Database driver connection and protocol failures - [`MIGRATION`](#migration): Migration authoring, planning, checking, and execution - [`PLAN`](#plan): Query plan constraints - [`BUDGET`](#budget): Query budget violations - [`LINT`](#lint): Query lint findings - [`PARADEDB`](#paradedb): ParadeDB extension: search-function arguments - [`POSTGIS`](#postgis): PostGIS extension: geometry construction and validation - [`SUPABASE`](#supabase): Supabase extension: config wiring and JWT handling - [`TESTKIT`](#testkit) ## CONFIG [#config] ### CONFIG.CONTRACT_MISSING [#CONFIG.CONTRACT_MISSING] The `contract` section is missing (or incomplete) in `prisma.config.ts` when a command needs it, raised by `prisma contract emit` when the config has no contract configuration, no schema path, or the referenced authoring entrypoint cannot be resolved. Payload: none. ### CONFIG.CONTRACT_TYPES_MODULE_MISSING [#CONFIG.CONTRACT_TYPES_MODULE_MISSING] `contract emit`, the Vite plugin, or a command that writes a contract snapshot (`db init`, `db update`, `db sign`, `migrate`, `migration new`, `migration plan`) was run with a config that has no `contract.typesModule`, the module a generated `contract.d.ts` imports the framework and family contract types from. Raised before anything is written. A target package's `defineConfig` sets it, so a config from one that does not was built against an older release of that package; a config assembled by hand sets `contract.typesModule` itself. Payload: none. ### CONFIG.DB_CONNECTION_REQUIRED [#CONFIG.DB_CONNECTION_REQUIRED] A DB-connected command (`db migrate`, `db init`, `db sign`, `db verify`, `db update`, `db schema`, and the migration scaffold commands) was run with no database connection available: no `--db ` flag and no `db.connection` in `prisma.config.ts`. The fix text names the exact retry command when known. Payload: `missingFlags` (optional). ### CONFIG.DRIVER_REQUIRED [#CONFIG.DRIVER_REQUIRED] A DB-connected command was run but `prisma.config.ts` has no control-plane `driver` entry (e.g. `driver: postgresDriver`). Raised by the migration command scaffold, `db migrate`, `db sign`, `db verify`, and `db schema`. Payload: none. ### CONFIG.EVALUATION_FAILED [#CONFIG.EVALUATION_FAILED] The config module could not be evaluated at all: a syntax error in `prisma.config.ts`, or the module threw during import. Raised by the config loader for any command that needs config; loading fails outright (no per-section diagnostics are possible for a module that does not evaluate) and every command exits `2` with this error. The underlying evaluation error's message is carried in `why` and the original error in `cause` (in-process only). The path, when known, is carried in `where.path`. Payload: none. ### CONFIG.FAMILY_READ_MARKER_REQUIRED [#CONFIG.FAMILY_READ_MARKER_REQUIRED] Reserved: `db verify` needs the family package to export `verify.readMarker()` and it is absent. Declared in the shared error factories but not raised by any command today. ### CONFIG.FILE_NOT_FOUND [#CONFIG.FILE_NOT_FOUND] No `prisma.config.ts` (or the explicitly passed config path) could be found when loading configuration, raised by the config loader for any command that needs config. The fix is to run `prisma orm init` to create one. The path, when known, is carried in `where.path`. Payload: none. ### CONFIG.MIGRATION_MODULE_MISSING [#CONFIG.MIGRATION_MODULE_MISSING] `migration new` or `migration plan` was run with a config that has no `migrations.module`, the module a written `migration.ts` imports `Migration`, `MigrationCLI` and the operation helpers from. Raised before anything is written. A target package's `defineConfig` sets it, so a config from one that does not was built against an older release of that package; a config assembled by hand sets `migrations.module` itself. Payload: none. ### CONFIG.MISSING_EXTENSION_PACKS [#CONFIG.MISSING_EXTENSION_PACKS] The contract declares extension packs that the CLI config does not provide matching descriptors for; raised when resolving framework components for any command that loads the contract. The fix is to add the missing extension descriptors to `extensions` in `prisma.config.ts`. Payload: `missingExtensionPacks`, `providedComponentIds`. ### CONFIG.QUERY_RUNNER_FACTORY_REQUIRED [#CONFIG.QUERY_RUNNER_FACTORY_REQUIRED] Reserved: `db verify` needs `db.queryRunnerFactory` in `prisma.config.ts` and it is absent. Declared in the shared error factories but not raised by any command today. ### CONFIG.VALIDATION_FAILED [#CONFIG.VALIDATION_FAILED] `prisma.config.ts` loaded but a config section is missing or malformed, as seen by the ORM's own config loader (the language server, the vite plugin, and any tool that calls `loadConfig` outside a command run). The loader validates the `orm` section against its schema and returns one diagnostic per problem, each tagged with the top-level subsection it concerns (`meta.section`: `family`, `target`, `adapter`, `driver`, `extensions`, `db`, `contract`, `migrations`, or `formatter`); a command fails with the diagnostic (exit `2`) only when it reads that section. Under the `prisma` CLI the same problems are reported by the engine instead, as `CLI.CONFIG_FIELD_INVALID` diagnostics (one per field, `meta.section: 'orm'`, `meta.field` the dotted path, `where.path` the config file that declared the field) accompanying `CLI.CONFIG_SECTION_INVALID`. A `contract.typesModule` or `migrations.module` that is a path or a URL (it begins `.`, `/` or a backslash, holds a backslash, or begins with a URL scheme such as `file:` or a Windows drive such as `C:`) is refused here, before anything is written: generated files are written beside the contract and beside each migration, so a path resolves from at most one of them; name the module the way a package is imported, or by a `#` import declared in the `imports` of the package that holds the generated files. Also raised by framework-component resolution for fields like `frameworkComponents[]`, `frameworkComponents[].kind`/`familyId`/`targetId`, `contract.targetFamily`, and `contract.target`, and by contract-path resolution when `config.contract.output` is absent (those sites carry no `section`). Payload: `field` (loader diagnostics), `section` (loader diagnostics; optional elsewhere). ### CONFIG.VERSION_MARKER_MISSING [#CONFIG.VERSION_MARKER_MISSING] The config module evaluated, but its default export was not created by the current `defineConfig`: a plain object export, a spread copy of a `defineConfig` result, or a config produced by a different `defineConfig` (for example a classic Prisma ORM 7 config file). Raised by the config loader before validation; loading fails outright and every command exits `2` with this error. The fix is to create the config with `defineConfig` (imported from your target package's `/config` entrypoint, for example `@prisma/orm-postgres/config`) and export its return value directly. The path, when known, is carried in `where.path`. Payload: none. ## CLI [#cli] ### CLI.CONFIG_ARG_MISSING_PATH [#CLI.CONFIG_ARG_MISSING_PATH] The migration-file CLI (`prisma migration`) received `--config` without a path argument, either a bare trailing `--config`, or `--config` immediately followed by another flag (e.g. `--config --dry-run`). The CLI fails fast instead of consuming the next flag as the config path or silently falling back to default config discovery. Payload: `nextToken` (present only when another flag followed `--config`). ### CLI.CONSENT_REQUIRED [#CLI.CONSENT_REQUIRED] Raised by the CLI engine, not by Prisma ORM's own code; the engine's entry is the reference: [CLI.CONSENT_REQUIRED](https://www.prisma.io/docs/cli/error-reference#CLI.CONSENT_REQUIRED). `migration plan` and `db update` raise it when the plan would lose data, or for `db update` change who can read or write data, and the run has nobody to answer: it is not interactive, or `--yes` is set. The command asks one question per model, field or storage name whose data an operation would lose, and `db update` also one per operation that would change who can read or write a model's data, such as disabling row-level security on Postgres. The error lists every question still unanswered, with the flags that answer each: `--delete ` lets the plan lose that data (for a type change, it keeps the field and runs the database's own cast), for a model or field `--rename :` keeps it under a new name, for a field whose type changes, `migration plan` also offers `--convert `, which writes a slot for the conversion, and `--allow ` lets `db update` change who can read or write that model's data. Data no model of the origin contract stores can only be deleted. A field of a model the plan renames is named through the model's new name: after `--rename Profile:User`, the question about the dropped `nickname` field is answered with `--delete User.nickname` or `--rename User.nickname:User.handle`. A field whose model the destination names differently, with no statement renaming the model, is offered only `--delete`, and the question says to pass `--rename :` first; the next question then offers the field rename. On MongoDB, removing a field from a model is asked about too, and `--delete` removes it from every document that holds it; with no snapshot of the origin contract the field is named `.`. Nothing is written or applied. `--confirm` does not answer these questions. Payload: `subject`, `verbs`, `unanswered` (each with its `subject` and `verbs`). ### CLI.CONSENT_UNUSED [#CLI.CONSENT_UNUSED] Raised by the CLI engine; the engine's entry is the reference: [CLI.CONSENT_UNUSED](https://www.prisma.io/docs/cli/error-reference#CLI.CONSENT_UNUSED). `migration plan` and `db update` raise it when a `--delete` or `--allow` value answers no question the plan asks, for example a mistyped name or a model the plan does not drop, before they write or apply anything. A `db update --dry-run` asks no questions; it checks its `--delete` and `--allow` values against the subjects an apply would ask about and refuses an unmatched one with `MIGRATION.STATEMENT_ANSWERS_NO_QUESTION` instead. ### CLI.CONTRACT_ARG_CONFLICT [#CLI.CONTRACT_ARG_CONFLICT] `prisma db sign` was given a contract reference twice, once as the positional argument and once as `--contract`, and there is no rule for which one wins. Pass it once. Payload: `positional`, `flag`. ### CLI.ADVANCE_REF_ARG_CONFLICT [#CLI.ADVANCE_REF_ARG_CONFLICT] `prisma db sign` or `prisma db migrate` was told both which ref to advance (`--advance-ref `) and not to advance any ref (`--no-advance-ref`), and there is no rule for which one wins. Pass one of them. Payload: `advanceRef`. ### CLI.FILE_NOT_FOUND [#CLI.FILE_NOT_FOUND] A file the command needs does not exist at the given path. Produced by several commands: the migration command scaffold, `db migrate`, `migration plan`, `migration show`, `db sign`, `db update`, `db verify`, and `migration ref` all raise it when the emitted `contract.json` (or another required file) is missing from the expected location. Most sites carry the path in `where.path`; the `migration new` contract-file site carries it in the summary text only. Payload: none. ### CLI.FILE_WRITE_FAILED [#CLI.FILE_WRITE_FAILED] Writing a file failed: currently raised when `contract format` cannot write the formatted PSL source back to disk (e.g. the file is not writable). The underlying failure is attached as `cause`. Payload: none. ### CLI.INIT_AUTHORING_UNSUPPORTED [#CLI.INIT_AUTHORING_UNSUPPORTED] `prisma orm init --authoring ` names a way to write the contract that the target package's init contribution does not offer. Raised after the target package is installed and before any scaffold file is written. When init's install added declarations to `package.json`, the next actions name them and give the command that removes them; when it only rewrote a declared range, `packagesAdded` is empty and the next action names the declaration and its old range to restore. When the install changed nothing, there is no such action. Maps to init exit code 2 (PRECONDITION). Payload: `packageName`, `authoring`, `offered` (the modes the package lists), and `packagesAdded` when init's install changed `package.json`: the declarations it added, or an empty list when it only rewrote a declared range. ### CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH [#CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH] During `prisma orm init`, `--authoring` and `--schema-path` disagree on file extension, for example `--authoring psl` with a schema path ending in `.ts`. Raised before any scaffold files are written, so the project tree stays untouched. Payload: `authoring`, `schemaPath`, `actualExtension`, `expectedExtension`. ### CLI.INIT_CONTRIBUTION_UNAVAILABLE [#CLI.INIT_CONTRIBUTION_UNAVAILABLE] `prisma orm init` installed the target package, but the package does not export `./init` (`reason: no-entrypoint`), its init module cannot be loaded because the file its export names is missing or the module throws while loading (`reason: unloadable`, with the cause in `why`), or the default export of `/init` is not an init contribution (`reason: invalid-shape`, with what is wrong in `why`). `invalid-shape` also covers a package whose config module exports `prisma7Schema` while its contribution has no `prisma7QuickReference`. Init resolves `./init` with the `import` condition. The package stays installed and no scaffold file is written. The next actions name what init's install changed in `package.json`, read from the file before and after: the packages it declared, with the command that removes them, and any declaration whose range it rewrote, with the old range. They are left out when the install changed nothing. The fix is to write `prisma.config.ts` by hand, importing `defineConfig` from the package, or, for `unloadable`, to reinstall it. When `--target` (or the name typed into the picker) is not in the list of known target packages, `why` first says the value is not one of the short names and was therefore taken as a package name, and the fix adds that a listed package is named by its short name; `--target sqlite`, for example, installs the registry package `sqlite`. Maps to init exit code 2 (PRECONDITION). Payload: `packageName`, `module`, `reason`, `takenAsPackageName: true` for a package in no list, and `packagesAdded` when init's install changed `package.json`: the declarations it added, or an empty list when it only rewrote a declared range. ### CLI.INIT_EMIT_FAILED [#CLI.INIT_EMIT_FAILED] During `prisma orm init`, the `prisma contract emit` step failed after a successful dependency install. Scaffolded files and installed dependencies remain on disk; the user fixes the contract file and re-runs the emit command. `orm init` completes with this as a finding and exits 5. Payload: `filesWritten`, `cause`. ### CLI.INIT_FLAG_CONFLICT [#CLI.INIT_FLAG_CONFLICT] `prisma orm init --from-prisma7-schema ` was combined with `--schema-path` or `--authoring`. The first names an existing Prisma ORM 7 schema as the contract source; the other two describe a starter schema to write, so the pair contradicts itself. Raised before anything is read or written. Maps to init exit code 2 (PRECONDITION). Payload: `flags` (the two kebab-case flag names). ### CLI.INIT_INSTALL_FAILED [#CLI.INIT_INSTALL_FAILED] During `prisma orm init`, dependency installation failed. The first install, of the target package and `dotenv`, runs before anything is written, because init writes the project from the target package; when that install fails, `filesWritten` is empty and the next action is to run `orm init` again once the dependencies install. When a later install fails, the scaffold is already on disk, and the next actions carry the install command that was attempted and the emit that was waiting on it. `orm init` completes with this as a finding and exits 4. Payload: `filesWritten`, plus `install` (the attempted command, the manager, its exit code and the tail of its stderr). ### CLI.INIT_INVALID_FLAG_VALUE [#CLI.INIT_INVALID_FLAG_VALUE] A flag passed to `prisma orm init` has a value outside its allowed set (for example `--target` with a value that is neither a short name in the list of known target packages, such as `postgres` or `mongodb`, nor a valid npm package name). A name typed into the picker's "Another target package" entry is checked the same way and refused with this code, worded as the typed answer rather than as a flag. Maps to init exit code 2 (PRECONDITION). Payload: `flag`, `value`, `allowed` (only values a caller can pass back: for `--target`, the short names), and, for `--target`, `acceptsPackageName: true` and `problems`: why the value is not a valid package name, as `validate-npm-package-name` reports it. ### CLI.INIT_INVALID_MANIFEST [#CLI.INIT_INVALID_MANIFEST] `prisma orm init` could not parse the project's `package.json` as JSON. Init reads the manifest to merge scripts and to skip `@types/node` when already declared, so a malformed file is a hard precondition failure the user can fix and re-run. Maps to init exit code 2 (PRECONDITION). Payload: `path`, `cause`. ### CLI.INIT_INVALID_OUTPUT_DOCUMENT [#CLI.INIT_INVALID_OUTPUT_DOCUMENT] `prisma orm init` completed but its own success output document failed schema validation. This indicates a bug in Prisma ORM itself, not user error. The engine-hosted `orm init` settles it as an errored envelope at exit 2 (the commander `orm init`, deleted in the S5 cutover, mapped it to exit 1), because the ORM's error boundary converts every failure into a structured settlement and the engine reserves exit 1 for a throw that reaches it uncaught. Payload: none. ### CLI.INIT_INVALID_TSCONFIG [#CLI.INIT_INVALID_TSCONFIG] `prisma orm init` could not parse the project's existing `tsconfig.json`, even with JSONC tolerance (comments and trailing commas). Init merges required compiler options into it, so an unreadable file blocks the run; raised before any scaffold file is written. Maps to init exit code 2 (PRECONDITION). Payload: `path`, `cause`. ### CLI.INIT_MISSING_FLAGS [#CLI.INIT_MISSING_FLAGS] `prisma orm init` ran non-interactively (e.g. `--yes`, or stdin is not a TTY) but one or more required inputs (`--target`, `--authoring`, `--schema-path`) were not supplied as flags. Every missing flag is listed so scripts and agents can react without parsing English. When detection found a Prisma ORM 7 project, the message also names `--from-prisma7-schema ` as the alternative; a Prisma 6 MongoDB project gets `CLI.INIT_PRISMA6_SCHEMA_FOUND` instead. Maps to init exit code 2 (PRECONDITION). Payload: `missingFlags`, `prisma7SchemaPath` (`null` when nothing Prisma ORM 7 was found). ### CLI.INIT_PRISMA6_SCHEMA_FOUND [#CLI.INIT_PRISMA6_SCHEMA_FOUND] `prisma orm init` found a Prisma 6 MongoDB schema (a `datasource` with `provider = "mongodb"`, which Prisma ORM 7 does not have) where the Prisma 6 CLI looks for it (the path a Prisma 6 `prisma.config.*` or the `prisma.schema` field of `package.json` names, else `prisma/schema.prisma`, `schema.prisma` or the `prisma/schema` folder), or at the path `--from-prisma7-schema` names. Prisma ORM can read that schema through `prisma6Schema`, but init does not set it up: both CLIs are published as `prisma`, and the Prisma 6 CLI also reads `prisma.config.ts`. Init stops before asking, installing, or writing anything, and its next actions are the side-by-side setup: move the Prisma 6 CLI to an npm alias (`"prisma6": "npm:prisma@"`) run through a `prisma6` script with its own config file, install Prisma ORM, write `prisma.config.ts` with `prisma6Schema`, then run `contract emit` and `db sign`. Passing `--target` and `--authoring` skips this and sets up a starter in the same project, with a warning that it breaks the Prisma 6 CLI: the `prisma.config.ts` it writes makes every Prisma 6 command fail until Prisma 6 gets its own config file, and its install step replaces the Prisma 6 CLI with `prisma@latest`. Maps to init exit code 2 (PRECONDITION). Payload: `schemaPath`, `prismaConfig` (the Prisma ORM config to write), `prisma6Config` (the Prisma 6 config to write; `null` when the project's own `prisma.config.*` is to be renamed instead). ### CLI.INIT_PRISMA7_CONFIG_COLLISION [#CLI.INIT_PRISMA7_CONFIG_COLLISION] On the Prisma ORM 7 path of `prisma orm init`, `prisma.config.*` evaluated as a Prisma ORM 7 config (no `$prismaConfig` marker) while a `prisma7.config.*` also exists. Init renames the Prisma ORM 7 config to `prisma7.config.*` so Prisma ORM can write its own, and cannot rename onto an existing file. Nothing is written. Maps to init exit code 2 (PRECONDITION). Payload: `prismaConfigPath`, `prisma7ConfigPath`. ### CLI.INIT_PRISMA7_CONFIG_UNREADABLE [#CLI.INIT_PRISMA7_CONFIG_UNREADABLE] On the Prisma ORM 7 path of `prisma orm init`, `prisma.config.*` exists but failed to evaluate (typically a Prisma ORM 7 config importing `prisma/config` in a checkout whose dependencies are not installed). Init cannot tell whether the file is Prisma ORM 7's, to rename, or its own, to replace, so it refuses rather than overwrite it. The fix is to install the project's dependencies so the config evaluates, or rename it to `prisma7.config.` by hand; when a `prisma7.config.*` already exists, init leaves `prisma.config.*` alone and the fix is to install the dependencies and fix the error in it instead. The normal path is unaffected: without the flag or a yes to the Prisma ORM 7 question, the file is treated as it is today. Nothing is written. Maps to init exit code 2 (PRECONDITION). Payload: `path`, `why`, `prisma7ConfigPath` (`null` when none exists). ### CLI.INIT_PRISMA7_PROVIDER_UNSUPPORTED [#CLI.INIT_PRISMA7_PROVIDER_UNSUPPORTED] On the Prisma ORM 7 path of `prisma orm init`, the schema's `datasource` block declares a provider Prisma ORM has no target for, or no string provider at all. The supported list is in the payload. When the provider is not a string literal, passing `--target` names the database instead; a string provider with no target is refused whatever `--target` says. Nothing is written or installed. Maps to init exit code 2 (PRECONDITION). Payload: `schemaPath`, `provider` (`null` when not a string literal), `supported`. ### CLI.INIT_PRISMA7_SCHEMA_INVALID [#CLI.INIT_PRISMA7_SCHEMA_INVALID] The path `prisma orm init` was asked to use as a Prisma ORM 7 schema (`--from-prisma7-schema`, or the path the interactive question named) does not exist, or neither it nor any `.prisma` file under it has a `datasource` block. Nothing is written. Maps to init exit code 2 (PRECONDITION). Payload: `schemaPath`, `reason` (`absent` or `no-datasource`). ### CLI.INIT_PRISMA7_SCHEMA_REFUSED [#CLI.INIT_PRISMA7_SCHEMA_REFUSED] On the Prisma ORM 7 path of `prisma orm init`, the target package's Prisma ORM 7 contract source refused the schema, for example because it contains a `view` block. Init runs the source after installing the target package, `dotenv` and the drivers the list entry names, and before any consent question or file change, so no scaffold file is written. The `why` lists each diagnostic as `:: `. The next actions say to edit the schema as each finding says (the target package's README lists every refusal and its fix) or to run init without `--from-prisma7-schema`. When init's install added declarations to `package.json`, the next actions name them and give the command that removes them; when it only rewrote a declared range, `packagesAdded` is empty and the next action names the declaration and its old range to restore. When the install changed nothing, there is no such action. Maps to init exit code 2 (PRECONDITION). Payload: `schemaPath`, `summary`, `diagnostics`, and `packagesAdded` when the install changed `package.json`: the declarations it added (the remove command names only these), or an empty list when it only rewrote a declared range. ### CLI.INIT_PRISMA7_SOURCE_UNAVAILABLE [#CLI.INIT_PRISMA7_SOURCE_UNAVAILABLE] On the Prisma ORM 7 path of `prisma orm init`, the target package cannot read the Prisma ORM 7 schema. Either `--target` names a package in no list while `--from-prisma7-schema` is passed (`reason: unlisted`), because only a listed package can keep a Prisma ORM 7 schema; this is refused before anything is installed, and the fix is to drop `--from-prisma7-schema` for a fresh contract on that package, or to name a listed package. Without the flag, init does not offer the schema to an unlisted package: it sets up a fresh project and leaves the schema alone, with a warning unless `--authoring` or `--schema-path` asked for a starter. Or it has no `prisma7Schema` export while `--from-prisma7-schema` asked for one (`reason: no-prisma7-source`), or the config module its contribution names could not be found from the project (`reason: not-resolvable`), or was found but could not be loaded because its file is missing or it throws while loading (`reason: unloadable`, with the module in `module` and the cause in `why`). When the user entered the Prisma ORM 7 path by answering yes to init's question instead of passing the flag, a package without a Prisma ORM 7 source is not an error: init warns and runs as a fresh init. No scaffold file is written; the install before the check may have changed `package.json`. When init's install added declarations to `package.json`, the next actions name them and give the command that removes them; when it only rewrote a declared range, `packagesAdded` is empty and the next action names the declaration and its old range to restore. When the install changed nothing, there is no such action. Maps to init exit code 2 (PRECONDITION). Payload: `schemaPath`, `packageName`, `reason` (`unlisted`, `no-prisma7-source`, `not-resolvable` or `unloadable`), `module` for `not-resolvable` and `unloadable`, and `packagesAdded` when init's install changed `package.json`: the declarations it added, or an empty list when it only rewrote a declared range. ### CLI.INIT_PRISMA7_TARGET_MISMATCH [#CLI.INIT_PRISMA7_TARGET_MISMATCH] On the Prisma ORM 7 path of `prisma orm init`, `--target` names a different database than the schema's `datasource` provider, for example `--target mongodb` for a schema that declares `provider = "postgresql"`. With `--from-prisma7-schema` it is refused before anything is asked, installed, or written. Without the flag init does not ask its Prisma ORM 7 question and runs as a fresh init, so this code is not raised. Maps to init exit code 2 (PRECONDITION). Payload: `schemaPath`, `provider`, `target` (as passed). ### CLI.INIT_PROBE_FAILED [#CLI.INIT_PROBE_FAILED] `prisma orm init --probe-db --strict-probe` was run and the database probe could not complete. Every case needs `--strict-probe`; without it each is a warning and init succeeds. The cases: `DATABASE_URL` is not set in the shell environment (the probe does not read `.env`); the target package's probe could not connect (a network or authentication error, or the probe threw); it did not finish within 60 seconds; its driver is not installed, or is installed but failed to load; it connected but its version query failed or the answer held no readable version; it gave a malformed answer; or the target package has no probe. A server older than the stated minimum is never this error, only a warning. Scaffolded files are already on disk when this fires. Maps to init exit code 2 (PRECONDITION). Payload: `filesWritten`, `cause`. ### CLI.INIT_REINIT_NEEDS_FORCE [#CLI.INIT_REINIT_NEEDS_FORCE] `prisma orm init` ran non-interactively in a directory that already has a `prisma.config.ts`, and consent to overwrite the existing scaffold was not given. Re-scaffolding is destructive, so it needs explicit consent: interactively, `orm init` asks the user to type the working directory's name back; non-interactively, the same consent is granted by `--confirm `. Neither `--yes` nor any flag skips it. Maps to init exit code 2 (PRECONDITION). Payload: none. The code was raised by the commander `orm init` (deleted in the S5 cutover), whose consent flag was `--force`. The engine-hosted `orm init` reaches the same outcome through the engine's own `CLI.CONSENT_REQUIRED`, which names the exact `--confirm` value to pass. ### CLI.INIT_SKILL_INSTALL_FAILED [#CLI.INIT_SKILL_INSTALL_FAILED] Retired. `prisma orm init` used to fetch the agent skills from GitHub with `skills add`, and raised this at exit `6` when that fetch failed. The skills now ship inside the `@prisma/orm-*` packages a project installs, and `orm init` no longer touches them at all: skills setup belongs to the family-level `prisma init` command, and `prisma skills sync` copies the skills out of the installed packages whenever it runs. Init's remaining failure exits are `4` (dependency install failed) and `5` (contract emission failed); there is no exit `6`, and nothing raises this code. ### CLI.INIT_STRICT_PROBE_WITHOUT_PROBE [#CLI.INIT_STRICT_PROBE_WITHOUT_PROBE] `prisma orm init --strict-probe` was supplied without `--probe-db`. Init is offline-by-default, so no probe runs without `--probe-db`; rather than silently ignoring the strict flag, init errors and tells the user to add `--probe-db` or drop `--strict-probe`. Maps to init exit code 2 (PRECONDITION). Payload: none. ### CLI.INIT_TARGET_PACKAGE_NOT_INSTALLED [#CLI.INIT_TARGET_PACKAGE_NOT_INSTALLED] `prisma orm init` cannot find the target package from the project, so it cannot read the init contribution it writes every scaffold file from, and it stops before writing any of them. Either `--skip-install` forbade installing the package and the project does not have it, in which case nothing at all was changed, or init's install command exited successfully and the package still cannot be found from the project (for example under Yarn Plug'n'Play), in which case the install may have changed `package.json` and the lockfile. The summary and `why` say which, and the second names the command that ran. The next action names the install command, for example `pnpm add @prisma/orm-postgres pg`. For a package in no list that is missing under `--skip-install`, it names no install command: it says to run init again without `--skip-install`, which checks the package's keyword before installing it. For a package in no list, `why` first says the value is not one of the short names and was therefore taken as a package name, and the fix adds that a listed package is named by its short name. When init's install added declarations to `package.json`, the next actions name them and give the command that removes them; when it only rewrote a declared range, `packagesAdded` is empty and the next action names the declaration and its old range to restore. When the install changed nothing, there is no such action. Maps to init exit code 2 (PRECONDITION). Payload: `packageName`, `installCommand`, `takenAsPackageName: true` for a package in no list, and `packagesAdded` when init's install changed `package.json`: the declarations it added, or an empty list when it only rewrote a declared range. ### CLI.INIT_TARGET_PACKAGE_NOT_VERIFIED [#CLI.INIT_TARGET_PACKAGE_NOT_VERIFIED] `prisma orm init` was given a package in no list, and before installing it found that the package does not list the keyword `prisma-orm-extension` in its `package.json` (`reason: keyword-missing`), that the registry has no such package (`reason: not-found`), or that it could not read the package's keywords from the registry (`reason: lookup-failed`). Init checks the copy it is about to load: the `latest` version on the registry `npm_config_registry` names (in any letter case; by default `https://registry.npmjs.org`) when it will install the package, and the installed `package.json` when the project already declares the package and has it on disk, or under `--skip-install`. Init sends no credentials, reads no other package-manager configuration and uses no proxy settings, so a package on a registry that needs credentials, on a scope's own registry, or behind a proxy is reported as `not-found` or `lookup-failed`; install it yourself and run init again. An installed `package.json` that cannot be parsed is `lookup-failed`. Nothing was changed. Maps to init exit code 2 (PRECONDITION). Payload: `reason`, `packageName`, `keyword`, `takenAsPackageName: true`, and `registry` (the URL init asked, without credentials) when init asked the registry. ### CLI.INIT_USER_ABORTED [#CLI.INIT_USER_ABORTED] The user cancelled an interactive `prisma orm init` prompt (Ctrl-C, escape, or declining a selection) before all required inputs were supplied. No files were modified. Severity is `info`, not `error`; maps to init exit code 3 (USER_ABORTED). Payload: none. Raised by the commander `orm init` (deleted in the S5 cutover). On the engine-hosted `orm init` a cancelled prompt is the engine's own `CLI.PROMPT_CANCELLED`, which exits 3 for every command rather than only this one; the engine-hosted `orm init` keeps this code for a consent the user declines, which settles as an errored envelope at exit 2 like every other structured failure there. Because that command's consent declares a token, the engine answers a wrong or absent answer with `CLI.PROMPT_INVALID` or `CLI.CONSENT_REQUIRED` before a decline can be expressed, so the code is the refusal that runs if a future consent drops its token. ### CLI.INIT_WRITE_FAILED [#CLI.INIT_WRITE_FAILED] `prisma orm init` could not write one of the files it scaffolds: a directory sitting where the file goes, permissions, a full disk. Everything that can be read and parsed is checked before the first write, so this is the failure that survives that check; the files written before it are already on disk and are listed so a follow-up run or agent knows the state it is resuming from. On the Prisma ORM 7 path the config rename happens before the first write, so a completed rename is listed too (`filesRenamed`, `from` and `to`); it stays in place and a re-run writes the missing files beside it. Maps to init exit code 2 (PRECONDITION). Payload: `path`, `cause`, `filesWritten`, `filesRenamed`. ### CLI.INVALID_ARGUMENTS [#CLI.INVALID_ARGUMENTS] It has two producers. The CLI engine raises it when a command's arguments cannot be parsed; the engine's entry is the reference for that case: [CLI.INVALID_ARGUMENTS](https://www.prisma.io/docs/cli/error-reference#CLI.INVALID_ARGUMENTS). Prisma ORM's commands and control API raise it, with payloads of their own, for an option combination the engine cannot see, as follows. `db migrate`, `db migrate --show` and `db update` also raise it when they are given `--permit-policy-change` and `--to` names no ref: a contract hash, a migration, `@db`, `@empty`, or no `--to` at all. Only a ref declares policies, so there is nothing the flag could write. The commands raise it before they connect to the database. The control API's `migrate` raises it for `permitPolicyChange` without a `target` of kind `ref`, and `dbUpdate` for `permitPolicyChange` without a `ref`, before anything runs; its summary and fix then name those options, not the CLI flags. A ref that declares no policies is not refused: the flag then writes nothing. Payload: from the commands, `command` (`db migrate` or `db update`); from both, `to`, the `--to` value or the hash `target` names, when there is one. The control API's `dbUpdate` also raises it, before it reads the database, when its `ref` names a different contract than the `contract` it reconciles to: nothing was applied, and the payload is `refName`, `refHash` and `contractStorageHash`. Pass the contract the ref names, or a ref at that contract. ### CLI.INVALID_OUTPUT_FORMAT [#CLI.INVALID_OUTPUT_FORMAT] The main CLI received a `--format` value other than `pretty` or `json`. Raised during global-flag resolution, before any command logic runs. Payload: `value`, `allowed`. ### CLI.INVALID_VERIFY_MODE [#CLI.INVALID_VERIFY_MODE] `prisma db verify` was given a contradictory mode combination: `--marker-only` together with `--schema-only`, or `--strict` together with `--marker-only` (strict requires schema verification, which marker-only skips). Payload: none. ### CLI.JSON_FORMAT_UNSUPPORTED [#CLI.JSON_FORMAT_UNSUPPORTED] Reserved: a command was asked for a `--json` sub-format it does not support; the error lists the formats the command does accept. Declared in the shared error factories but not raised by any command today. Payload: `command`, `format`, `supportedFormats`. ### CLI.MIGRATION_CONFIG_NOT_FOUND [#CLI.MIGRATION_CONFIG_NOT_FOUND] Running a `migration.ts` with node and no `--config` found no config that owns the migration. Without `--config`, the file uses the config whose migrations directory holds it: the nearest `prisma.config.ts` above the migration's directory if it owns it, else the `prisma.config.ts` in the working directory if that one does. The message names each config it checked, with the migrations directory it keeps or the reason it failed to load, and says to run the file again with `--config `. Payload: `migrationDir`, `checked`. ### CLI.OUTPUT_FORMAT_CONFLICT [#CLI.OUTPUT_FORMAT_CONFLICT] The main CLI received mutually exclusive output flags: `--format pretty` together with `--json`. Use `--format json` or `--json` alone for JSON output. Payload: none. ### CLI.PROMPT_REQUIRED [#CLI.PROMPT_REQUIRED] Raised by `@prisma/cli-engine`, not by this repository: a command asked a question that has no default, and the session could not show it: stdin is not a terminal, `--no-interactive` was passed, or `--yes` was asked to answer a prompt that declares no default. The `CLI` namespace is shared with the engine (see [ADR 239](https://github.com/prisma/orm/blob/v8.0.0-rc.25/docs/architecture%20docs/adrs/ADR%20239%20-%20Errors%20are%20structural%20envelopes%20with%20dotted%20namespace%20codes.md)); it is listed here because it settles runs of the ORM's commands. `prisma orm init` translates it for the two prompts that stand in for a required flag, so a missing `--target` or `--authoring` still reports `CLI.INIT_MISSING_FLAGS` with the full missing list. Payload: none. ### CLI.UNEXPECTED [#CLI.UNEXPECTED] Catch-all for an unanticipated failure inside a CLI command: an unclassified exception is wrapped in this envelope with the original message in the `why`, without the connection string. Thrown across nearly every command (migrate, db init/sign/update/verify, migration plan/new/show/status/log, contract emit, ref, inspect-live-schema, config loading). Payload: `code`, when the exception carried one that is not a structured code, such as a driver's `ECONNREFUSED` or a SQLSTATE; otherwise none. ### CLI.UNKNOWN_FLAG [#CLI.UNKNOWN_FLAG] The migration-file CLI (`prisma migration`) received a flag it does not recognise; wraps clipanion's unknown-syntax error at the parser boundary so consumers can build "did you mean" suggestions from meta instead of parsing the message. Payload: `flag`, `knownFlags`. ### CLI.V7_COMMAND [#CLI.V7_COMMAND] Settled by `@prisma/cli-engine` from the redirect table in `family.ts`, not raised by a command: the user typed a Prisma ORM 7 command path that Prisma ORM does not have, such as `prisma generate`, `prisma db push` or `prisma migrate dev`; instead of failing as unknown, the run settles with the summary "`prisma ` is a Prisma ORM 7 command and is not available in Prisma ORM". `why` says what the suggested Prisma ORM commands do and what they do not cover, and ends with how to install Prisma ORM 7's CLI (`npm install --save-dev @prisma/prisma7@7`) and run the same command as `prisma7 `, with a placeholder for every value Prisma ORM 7 requires (for example `prisma7 db execute --file `); for the `migrate` commands except `migrate diff`, that sentence applies while Prisma ORM 7 still owns the project's migrations. Next actions, in order: the replacement commands as run-command actions (labelled "Use the replacement" for one, "Step 1", "Step 2", … for several), a run-command pointing at the suggested command's `--help`, and an open-url action to the CLI docs when Prisma ORM has no equivalent. The engine's entry is the reference: [CLI.V7_COMMAND](https://www.prisma.io/docs/cli/error-reference#CLI.V7_COMMAND). Exits 2. Payload: none. ## CONTRACT [#contract] ### CONTRACT.ARGUMENT_INVALID [#CONTRACT.ARGUMENT_INVALID] A builder or helper on the contract-authoring surface is called with a bad argument: a composed authoring helper receives too many arguments or a malformed trailing options object, `field.sql({ id })` / `field.sql({ unique })` is used without a matching inline `.id(...)` / `.unique(...)` declaration, `model("Name", ...)` is called without a model definition, a nanoid ID generator is given a size outside 2–255, a TypeScript `type.*` type constructor receives an argument its data type's parameter schema refuses (meta: `helperPath`, `argumentIndex`; see `CONTRACT.TYPE_PARAMS_INVALID` for how PSL and the contract build report the same bound), or an authored index combines its cross-field parameters invalidly (fields and an expression together or neither, an expression without `name:`/`map:`, or `map:` combined with `name:`). In a `migration.ts`, the JSON operations `renameStoredKey`, `removeStoredKey` and `fillStoredKey`, and `replaceStoredValue` and `removeStoredValue` with `path`, raise it when the path is not an RFC 9535 JSONPath of member names and wildcards (`renameStoredKey({ table: "place", column: "history" }): path "$..lat" is not a JSONPath of member names (.name or ['name']) and wildcards ([*] or .*) from $`), when a key operation's path does not end at a member name (`path "$[*]" does not end at a member name, the key the operation acts on`), when a stored value path is `$` alone, when a stored value call combines `path` with `many` or `codecRef`, when `removeStoredValue` takes `nullable` without `path`, when `renameStoredKey`'s `to` is the key it renames, and when `fillStoredKey`'s value is not JSON, or, with `field`, is not a value that value object field takes, as in `fillStoredKey({ table: "place", column: "location" }): value 12 for field "GeoPoint.country" is not a String`: an enum value outside its value set, a list or an element of another type, a value object that lacks a required field or has a key it has no field for, or a scalar its codec's data type refuses. A `field` the end contract lacks, or one whose codec the stack does not have, is refused the same way, saying so, so running `migration.ts` fails before `ops.json` is written; `deleteRows` raises it for a value that is neither a string nor a finite number. Meta: `what`, the operation and its argument. A TypeScript `type.*` helper of a type choice, such as PostgreSQL's `type.DateTime`, takes its arguments as one object keyed by name, and raises it when given anything else (` takes its arguments as one object with the keys , such as ({