Prisma Error P2006: Provided Value Is Not Valid

Prisma error P2006 (Provided Value Is Not Valid) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.

Error code P2006 Prisma Last verified 2026-08-19

Quick Answer

Read error.meta.field_name and error.meta.field_value to see what was rejected. If that does not apply, coerce inputs at the API boundary: Number(), new Date(isoString), or a validation library (zod/class-validator) — the full checklist is below.

Error Code

Error code: P2006
Official name: Provided Value Is Not Valid
Service: Prisma

What does this error mean?

The provided value {field_value} for {model_name} field {field_name} is not valid

Common Causes

How to Fix

  1. Read error.meta.field_name and error.meta.field_value to see what was rejected
  2. Coerce inputs at the API boundary: Number(), new Date(isoString), or a validation library (zod/class-validator)
  3. For enums, assert membership against the generated Prisma enum type before querying
  4. Remember DateTime must be a valid Date or ISO-8601 string, not a Unix epoch number by default

Code Examples

Coerce before write typescript
const data = {
  quantity: Number(raw.quantity),        // '3' -> 3
  dueAt: new Date(raw.dueAt),            // '2026-08-19' -> Date
  status: raw.status as OrderStatus,     // enum cast
}
await prisma.order.create({ data })

Explicit coercion at the boundary turns noisy P2006 into predictable validation.

Framework-Specific Fixes

nestjs

Validate DTOs with class-validator so malformed types are rejected before they reach Prisma.

export class CreateOrderDto {
  @IsInt()
  @Min(1)
  quantity!: number

  @IsEnum(OrderStatus)
  status!: OrderStatus
}
prisma-client

Cast incoming values at the service layer; let TypeScript types from generated client catch mismatches at compile time.

const parsed = {
  quantity: Number(body.quantity),
  status: body.status as OrderStatus,
}
await prisma.order.create({ data: parsed })

You Might Also Like

Frequently Asked Questions

Why am I seeing Prisma error P2006?

Most often this happens when passing a string where the schema expects an Int or DateTime, or when supplying a value outside the enum members declared in the schema.

How do I fix Prisma error P2006?

Read error.meta.field_name and error.meta.field_value to see what was rejected.

Which frameworks have documented fixes for error P2006?

This page documents fixes for: nestjs, prisma-client.

Official Sources

This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.