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.
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: P2006
Official name: Provided Value Is Not Valid
Service: Prisma
The provided value {field_value} for {model_name} field {field_name} is not valid
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.
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
}
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 })
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.
Read error.meta.field_name and error.meta.field_value to see what was rejected.
This page documents fixes for: nestjs, prisma-client.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.