Skip to content

Misleading error message: ERR_INVALID_ARG_TYPE #26169

@KingAlastor

Description

@KingAlastor

Bug description

Prisma doesn't return table/column does not exist error when you're trying to run an update query (haven't tested others) but instead returns ERR_INVALID_ARG_TYPE error message stating that the object you're trying to pass to prisma has null value.

How to reproduce

  1. Create a prisma schema with a table like users with couple example colums, say name, email, location.
  2. Create a prisma statement to update user table with either an object or rawsql. In my example i tried this with 2 examples.
   await prisma.user.update({
    where: {
      id: userId,
    },
    data,
  });
await prisma.$executeRaw`
  UPDATE "users"
  SET "pending_actions" = array_remove(pending_actions, ${action})
  WHERE id = ${userId}
`;
  1. In the first example, give prisma a data object {name: "My name", email: "[email protected]", location: "Wherever"} - note that the 3rd column name doesn't exist on our schema. In the second example, you can modify either table value or column value to something that doesn't exist.

You will receive an error: ⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}

Expected behavior

When you run such queries in any SQL IDE, you get a simple error:
SQL Error [42703]: ERROR: column "location" does not exist.
I would expect Prisma to return the same kind of error message to me as well in my terminal if i'm running a query with faulty object/query where table/column doesn't exist.

Prisma information

model User {
  name              String
  email             String?
  location          String?
  pendingActions    String[]  @default([]) @map("pending_actions")

@@map("users")
}
   await prisma.user.update({
    where: {
      id: userId,
    },
    data,
  });
await prisma.$executeRaw`
  UPDATE "users"
  SET "pending_actions" = array_remove(pending_actions, ${action})
  WHERE id = ${userId}
`;

Environment & setup

  • OS: Windows
  • Database: PostgreSQL
  • Node.js version: 22.11.0

Prisma Version

prisma                  : 6.2.1   
@prisma/client          : 6.2.1   
Computed binaryTarget   : windows 
Operating System        : win32   
Architecture            : x64     
Node.js                 : v22.11.0
TypeScript              : 5.4.5
Query Engine (Node-API) : libquery-engine 4123509d24aa4dede1e864b46351bf2790323b69 (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine           : schema-engine-cli 4123509d24aa4dede1e864b46351bf2790323b69 (at node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm             : @prisma/prisma-schema-wasm 6.2.0-14.4123509d24aa4dede1e864b46351bf2790323b69
Default Engines Hash    : 4123509d24aa4dede1e864b46351bf2790323b69
Studio                  : 0.503.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions