Prisma error P2013 (Missing Required Argument) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
Read error.meta.argument_name / field_name / object_name to find what the call is missing. If that does not apply, compare the failing call with the generated client types - TypeScript flags most of these at compile time — the full checklist is below.
Error code: P2013
Official name: Missing Required Argument
Service: Prisma
Missing the required argument {argument_name} for field {field_name} on {object_name}.
import { Prisma } from '@prisma/client'
const data: Prisma.UserCreateInput = {
email: 'ada@example.com',
name: 'Ada',
}
await prisma.user.create({ data })
Prisma.UserCreateInput makes omitted required fields a compile-time error.
Let the generated TypeScript types do the work: unused or missing required fields fail type-check before runtime.
const data: Prisma.UserCreateInput = {
email: body.email,
// name is required in the model - TS errors here if omitted
}
await prisma.user.create({ data })
Build the data object from a validated DTO so missing fields surface as validation errors, not Prisma errors.
async create(@Body() dto: CreateUserDto) {
// dto guaranteed complete by class-validator
return this.prisma.user.create({ data: dto })
}
Most often this happens when create()/update() called without a field the schema requires, or when connect: {} used without the unique fields needed to identify the target record.
Read error.meta.argument_name / field_name / object_name to find what the call is missing.
This page documents fixes for: prisma-client, nestjs.
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.