Prisma Error P2013: Missing Required Argument

Prisma error P2013 (Missing Required Argument) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.

Error code P2013 Prisma Last verified 2026-08-19

Quick Answer

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

Error code: P2013
Official name: Missing Required Argument
Service: Prisma

What does this error mean?

Missing the required argument {argument_name} for field {field_name} on {object_name}.

Common Causes

How to Fix

  1. Read error.meta.argument_name / field_name / object_name to find what the call is missing
  2. Compare the failing call with the generated client types - TypeScript flags most of these at compile time
  3. For connect, always supply the unique field (usually id) of the record you want to attach
  4. If the data is dynamic (loop-built object), log the constructed argument to see what is missing

Code Examples

Type-checked create typescript
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.

Framework-Specific Fixes

prisma-client

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 })
nestjs

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 })
}

You Might Also Like

Frequently Asked Questions

Why am I seeing Prisma error P2013?

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.

How do I fix Prisma error P2013?

Read error.meta.argument_name / field_name / object_name to find what the call is missing.

Which frameworks have documented fixes for error P2013?

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

Official Sources

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