Skip to content

Error when pushing items to a scalar list with Prisma 7 #29200

@bre7

Description

@bre7

Bug description

There seems to be an issue when adding (push) items (list concatenation) to scalar lists on Prisma 7.4.0 which triggers fatal error.

Pushing a single item works.

P.S: Not sure if same as #28349

Severity

🚨 Critical: Data loss, app crash, security issue

Reproduction

See #29206

package.json Prisma 6

{
  "name": "p7-scalar-push.issue",
  "private": true,
  "engines": {
    "node": "22"
  },
  "type": "module",
  "dependencies": {
    "@prisma/adapter-pg": "6.19.2",
    "@prisma/client": "6.19.2"
  },
  "devDependencies": {
    "dotenv": "^17",
    "prisma": "6.19.2",
    "typescript": "^5"
  },
  "scripts": {
    "dev": "bun ./src/index.ts"
  }
}

package.json Prisma 7

{
  "name": "p7-scalar-push.issue",
  "private": true,
  "engines": {
    "node": "22"
  },
  "type": "module",
  "dependencies": {
    "@prisma/adapter-pg": "7.4.0",
    "@prisma/client": "7.4.0"
  },
  "devDependencies": {
    "dotenv": "^17",
    "prisma": "7.4.0",
    "typescript": "^5"
  },
  "scripts": {
    "dev": "bun ./src/index.ts"
  }
}

Expected vs. Actual Behavior

Expected results:

Add items to current list.

Actual result:

Fatal error on Prisma 7.4.0
Works fine with Prisma 6.19.2

Frequency

Consistently reproducible

Does this occur in development or production?

Both development and production

Is this a regression?

Unsure, but works fine with Prisma 6.19.2

Workaround

Downgrade to Prisma 6

Prisma Schema & Queries

generator client {
  provider   = "prisma-client"
  output     = "./generated/prisma"
  engineType = "client"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL") // Only with Prisma 6
}

model WhateverTable {
  id        String   @id @default(cuid())
  content   String[]
}
import { PrismaClient } from "../prisma/generated/prisma/client"
import { PrismaPg } from "@prisma/adapter-pg"

const adapter = new PrismaPg(
  {
    connectionString: `${process.env.DATABASE_URL!}&sslmode=no-verify`,
    ssl: { rejectUnauthorized: false },
  },
  { schema: process.env.DATABASE_SCHEMA! }
)
const prisma = new PrismaClient({ log: ["query", "info", "warn"], adapter })

const result = await prisma.whateverTable.update({
  where: { id: "s1" },
  data: {
    content: { push: ["2", "3"] },
  },
})

console.log(result)
CREATE TABLE "WhateverTable" ("id" text PRIMARY KEY, "content" text[]);

ALTER TABLE "WhateverTable" ADD CONSTRAINT content_one_dimensional CHECK (array_ndims(content) = 1);

INSERT INTO "WhateverTable" (id, content) VALUES ('s1', ARRAY['data1'])

Prisma Config

Using old setup

Logs & Debug Info

prisma:client clientVersion 7.4.0 +86ms
prisma:client:clientEngine Using driver adapter: {
  "provider": "postgres",
  "adapterName": "@prisma/adapter-pg",
  "config": {
    "connectionString": "postgresql://xxx:yyy@zzz/neondb?sslmode=require&channel_binding=require&sslmode=no-verify",
    "ssl": {
      "rejectUnauthorized": false
    }
  },
  "externalPool": null,
  "options": {}
} +1ms
prisma:client Prisma Client call: +7ms
prisma:client prisma.whateverTable.update({
  where: {
    id: "s1"
  },
  data: {
    content: {
      push: [
        "z",
        "x"
      ]
    }
  }
}) +2ms
prisma:client Generated request: +0ms
prisma:client {
  "modelName": "WhateverTable",
  "action": "updateOne",
  "query": {
    "arguments": {
      "where": {
        "id": "s1"
      },
      "data": {
        "content": {
          "push": [
            "z",
            "x"
          ]
        }
      }
    },
    "selection": {
      "$composites": true,
      "$scalars": true
    }
  }
}
 +0ms
prisma:client:clientEngine sending request +1ms
prisma:client:clientEngine query plan cache miss +96ms
prisma:client:clientEngine query plan created {
  "type": "dataMap",
  "args": {
    "expr": {
      "type": "let",
      "args": {
        "bindings": [
          {
            "name": "0",
            "expr": {
              "type": "unique",
              "args": {
                "type": "query",
                "args": {
                  "type": "templateSql",
                  "fragments": [
                    {
                      "type": "stringChunk",
                      "chunk": "UPDATE \"public\".\"WhateverTable\" SET \"content\" = \"public\".\"WhateverTable\".\"content\" || "
                    },
                    {
                      "type": "parameter"
                    },
                    {
                      "type": "stringChunk",
                      "chunk": " WHERE (\"public\".\"WhateverTable\".\"id\" = "
                    },
                    {
                      "type": "parameter"
                    },
                    {
                      "type": "stringChunk",
                      "chunk": " AND 1=1) RETURNING \"public\".\"WhateverTable\".\"id\", \"public\".\"WhateverTable\".\"content\""
                    }
                  ],
                  "args": [
                    [
                      {
                        "prisma__type": "param",
                        "prisma__value": {
                          "name": "%2",
                          "type": "String"
                        }
                      }
                    ],
                    {
                      "prisma__type": "param",
                      "prisma__value": {
                        "name": "%1",
                        "type": "String"
                      }
                    }
                  ],
                  "argTypes": [
                    {
                      "arity": "list",
                      "scalarType": "string",
                      "dbType": null
                    },
                    {
                      "arity": "scalar",
                      "scalarType": "string",
                      "dbType": "TEXT"
                    }
                  ],
                  "placeholderFormat": {
                    "prefix": "$",
                    "hasNumbering": true
                  },
                  "chunkable": true
                }
              }
            }
          }
        ],
        "expr": {
          "type": "seq",
          "args": [
            {
              "type": "let",
              "args": {
                "bindings": [
                  {
                    "name": "0",
                    "expr": {
                      "type": "validate",
                      "args": {
                        "expr": {
                          "type": "get",
                          "args": {
                            "name": "0"
                          }
                        },
                        "rules": [
                          {
                            "type": "rowCountNeq",
                            "args": 0
                          }
                        ],
                        "error_identifier": "MISSING_RECORD",
                        "context": {
                          "operation": "an update"
                        }
                      }
                    }
                  }
                ],
                "expr": {
                  "type": "unit"
                }
              }
            },
            {
              "type": "get",
              "args": {
                "name": "0"
              }
            }
          ]
        }
      }
    },
    "structure": {
      "type": "object",
      "serializedName": null,
      "fields": {
        "id": {
          "type": "field",
          "dbName": "id",
          "fieldType": {
            "arity": "required",
            "type": "string"
          }
        },
        "content": {
          "type": "field",
          "dbName": "content",
          "fieldType": {
            "arity": "list",
            "type": "string"
          }
        }
      },
      "skipNulls": false
    },
    "enums": {}
  }
} +8ms
prisma:driver-adapter:pg [js::query_raw] {
  "sql": "UPDATE \"public\".\"WhateverTable\" SET \"content\" = \"public\".\"WhateverTable\".\"content\" || $1 WHERE (\"public\".\"WhateverTable\".\"id\" = $2 AND 1=1) RETURNING \"public\".\"WhateverTable\".\"id\", \"public\".\"WhateverTable\".\"content\"",
  "args": [
    [
      [
        "z",
        "x"
      ]
    ],
    "s1"
  ],
  "argTypes": [
    {
      "arity": "list",
      "scalarType": "string",
      "dbType": null
    },
    {
      "arity": "scalar",
      "scalarType": "string",
      "dbType": "TEXT"
    }
  ]
} +123ms
prisma:driver-adapter:pg Error in performIO: {
  "length": 173,
  "name": "error",
  "severity": "ERROR",
  "code": "2202E",
  "detail": "Arrays with differing dimensions are not compatible for concatenation.",
  "file": "array_userfuncs.c",
  "routine": "array_cat",
  "stack": "error: cannot concatenate incompatible arrays\n    at ...\\node_modules\\pg-pool\\index.js:45:10\n    at processTicksAndRejections (native)"
} +312ms
prisma:client:request_handler {
  "name": "DriverAdapterError",
  "cause": {
    "originalCode": "2202E",
    "originalMessage": "cannot concatenate incompatible arrays",
    "kind": "postgres",
    "code": "2202E",
    "severity": "ERROR",
    "message": "cannot concatenate incompatible arrays",
    "detail": "Arrays with differing dimensions are not compatible for concatenation."
  }
} +321ms
646 |       this.onError(e);
647 |     }
648 |   }
649 |   onError(error) {
650 |     debug("Error in performIO: %O", error);
651 |     throw new DriverAdapterError(convertDriverError(error));
                ^
DriverAdapterError: cannot concatenate incompatible arrays
      cause: {
  originalCode: "2202E",
  originalMessage: "cannot concatenate incompatible arrays",
  kind: "postgres",
  code: "2202E",
  severity: "ERROR",
  message: "cannot concatenate incompatible arrays",
  detail: "Arrays with differing dimensions are not compatible for concatenation.",
  column: undefined,
  hint: undefined,
},
 clientVersion: "7.4.0",

      at onError (...\node_modules\@prisma\adapter-pg\dist\index.mjs:651:11)
      at performIO (...\node_modules\@prisma\adapter-pg\dist\index.mjs:646:12)
      at async queryRaw (...\node_modules\@prisma\adapter-pg\dist\index.mjs:566:41)

Bun v1.3.9 (Windows x64 baseline)
error: script "dev" exited with code 1

Environment & Setup

  • OS: Windows 10
  • Database: PostgreSQL 17 on Neon
  • Node.js version: 22

Prisma Version

v6

prisma                  : 6.19.2
@prisma/client          : 6.19.2
Computed binaryTarget   : windows
Operating System        : win32
Architecture            : x64
Node.js                 : v22.20.0
TypeScript              : 5.9.3
Query Engine (Node-API) : libquery-engine c2990dca591cba766e3b7ef5d9e8a84796e47ab7 (at node_modules\@prisma\engines\query_engine-windows.dll.node)
PSL                     : @prisma/prisma-schema-wasm 7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7
Schema Engine           : schema-engine-cli c2990dca591cba766e3b7ef5d9e8a84796e47ab7 (at node_modules\@prisma\engines\schema-engine-windows.exe)
Default Engines Hash    : c2990dca591cba766e3b7ef5d9e8a84796e47ab7
Studio                  : 0.511.0

v7

prisma               : 7.4.0
@prisma/client       : 7.4.0
Operating System     : win32
Architecture         : x64
Node.js              : v22.20.0
TypeScript           : 5.9.3
Query Compiler       : enabled
PSL                  : @prisma/prisma-schema-wasm 7.4.0-20.ab56fe763f921d033a6c195e7ddeb3e255bdbb57
Schema Engine        : schema-engine-cli ab56fe763f921d033a6c195e7ddeb3e255bdbb57 (at node_modules\@prisma\engines\schema-engine-windows.exe)
Default Engines Hash : ab56fe763f921d033a6c195e7ddeb3e255bdbb57
Studio               : 0.13.1

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