PrismaClientValidationError: Argument is missing - How to resolve? #20216
Replies: 6 comments 5 replies
-
Hi @delfincortesb 👋 Thank you for raising this question.
Can you please clarify if you are trying to include the const res = await prisma.documents_counter.update({
where:{
company_id: 2,
},
data:{
estimate_count: {
increment: 1,
},
},
include: {
companies: true
}
}) Or are you trying to perform a nested update on the companies relation as shown in the code snippet below: const res = await prisma.documents_counter.update({
where:{
company_id: 2,
},
data:{
estimate_count: {
increment: 1,
},
companies:{
create:{
name:"test",
username:"gab",
}
}
},
}) |
Beta Was this translation helpful? Give feedback.
-
This bug still happening to me. |
Beta Was this translation helpful? Give feedback.
-
+1, When I accidentally try to set a non-null field to |
Beta Was this translation helpful? Give feedback.
-
+1. I have encountered the same issue. It seems that I had the same issue as @Merkie described above. I was passing a JSON Object instead of a JSON Array and that's why Prisma complained. It would have been nice to have the error handling indicate this instead of |
Beta Was this translation helpful? Give feedback.
-
Anyone else stumbling onto this. You will also get this error if you try to search for |
Beta Was this translation helpful? Give feedback.
-
I was looking for the file that throws this error message, and seems that is it: https://github.com/prisma/prisma/blob/main/packages/client/src/runtime/core/errorRendering/applyValidationError.ts This error apparently is throwing on line 306:
I think maybe this message could be changed to something like
I could do it, but I would like to discuss about this before. |
Beta Was this translation helpful? Give feedback.
-
I'm encountering a PrismaClientValidationError when trying to update a record using the Prisma ORM. The error specifically states that the argument 'companies' is missing in the 'prisma.documents_counter.update()' invocation. Here's the error message I receive:
Here are some details and code snippets related to my setup:
Here's an example code snippet that illustrates the structure of my update operation:
I have reviewed the Prisma schema, and the 'companies' field is correctly defined in the 'documents_counter' model. However, when I try to include the 'companies' field in the update operation, I receive the 'Argument 'companies' is missing' error.
Here's some part of the prisma schema:
Beta Was this translation helpful? Give feedback.
All reactions