PANIC: Expected record selection to contain required model ID fields.: ConversionFailure("\"c266149d-e045-4db5-bee4-3e49f3252e65\"", "Int") in query-engine/core/src/interpreter/interpreter.rs:68:26
See original GitHub issueHi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Name | Version |
---|---|
Node | v16.13.0 |
OS | darwin-arm64 |
Prisma Client | 3.8.1 |
Query Engine | 0.1.0 |
Database | mysql |
Logs
prisma:tryLoadEnv Environment variables loaded from /Users/edmbn/Projects/remix/proc-app/.env
prisma:tryLoadEnv Environment variables loaded from /Users/edmbn/Projects/remix/proc-app/.env
prisma:client clientVersion: 3.8.1
prisma:client clientEngineType: library
prisma:client:libraryEngine internalSetup
prisma:client:libraryEngine Searching for Query Engine Library in /Users/edmbn/Projects/remix/proc-app/node_modules/.prisma/client
prisma:client:libraryEngine loadEngine using /Users/edmbn/Projects/remix/proc-app/node_modules/.prisma/client/libquery_engine-darwin-arm64.dylib.node
prisma:client:libraryEngine library starting
prisma:client:libraryEngine sending request, this.libraryStarted: false
prisma:client:libraryEngine library already starting, this.libraryStarted: false
prisma:client:libraryEngine library started
prisma:client:libraryEngine sending request, this.libraryStarted: true
Client Snippet
const organization = await db.organization.update({
where: { id: organizationId },
data: {
name: organizationInformation.name,
},
});
Schema
model Organization {
id Int @id @default(autoincrement())
name String
processes Process[]
}
model Process {
id String @id @default(uuid()) @db.VarChar(36)
description String? @db.LongText
organizationId Int
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@index([organizationId])
}
Generated SQL
CREATE TABLE `Organization` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `Process` (
`id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` longtext COLLATE utf8mb4_unicode_ci,
`organizationId` int NOT NULL,
PRIMARY KEY (`id`),
KEY `Process_organizationId_idx` (`organizationId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Used database
Planetscale
The error happens when updating any field of the Organization model.
I’m using referentialIntegrity
preview feature with option referentialIntegrity = "prisma"
Same error happens with prisma studio.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also have the issue. I had a user model with an autoincrement id (Int), and a reset token model with a cuid as the ID (String). Changing the reset token id to an Int and using a separate field for the the actual token string fixed the problem for me.
Seems like referential integrity does not like mixing ID data types across entities.
I can confirm this too.