New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent column data: Unexpected conversion failure from String to datetime. Reason: $trailing input
#22293
Comments
Hey @rajdtta, Thanks a lot for the report 🙏! Could you confirm whether this error also happens when you are not using Prisma Accelerate? |
I am also seeing a very similar error, but only when i enable the Inconsistent column data: Unexpected conversion failure from String(1972-02-01) to DateTime. Reason: $input contains invalid characters |
Hey @jkepps, Thanks for chiming in. Would you mind sharing part of your datamodel? I can reproduce your bug, but I'm assuming you're using a native type (with the To be clear, only the datetime fields of your datamodel are relevant. Thanks! |
@Weakky yeah definitely. i'm pretty sure this is the relevant model, and the field at issue is model Checkin {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @db.Timestamp(6)
updatedAt DateTime @default(now()) @updatedAt @db.Timestamp(6)
date DateTime @db.Date
routineId Int
memberId Int
autocheckin Boolean @default(false)
notPresentWarningSeen Boolean @default(false)
checkInAt DateTime? @db.Timestamp(6)
checkOutAt DateTime? @db.Timestamp(6)
timeWarningSeen Boolean @default(false)
routine Routine @relation(fields: [routineId], references: [id], onDelete: Cascade)
member Member @relation(fields: [memberId], references: [id], onDelete: Cascade)
checkinLocation CheckinLocation?
@@unique([date, routineId], name: "checkinDateRoutine", map: "checkinDateRoutine")
@@index([memberId])
@@index([routineId])
@@index([date], map: "IDX_ec5713aa719bae2482befb992b")
@@map("checkins")
} |
there are also these two related data models. i noticed that the contracts load fine on their own, but if i try to access a contract through a treatment provider i get the unexpected conversion error on the date fields model Contract {
id Int @id @default(autoincrement())
name String @unique
startingBalance Int
durationOfRewards Int?
durationOfMessaging Int?
createdAt DateTime @default(now()) @db.Timestamp(6)
updatedAt DateTime @default(now()) @updatedAt @db.Timestamp(6)
planYearEarningsLimit Int?
planYearStartsAt DateTime? @db.Date
requiresReferral Boolean @default(false)
endsAt DateTime? @db.Timestamp(6)
rewardsPlanId Int
tangoBrandKeys String[]
test Boolean @default(false)
type ContractType?
eligibleMemberCount Int?
enrollmentStartsAt DateTime? @db.Date
enrollmentEndsAt DateTime? @db.Date
memberBenefits MemberBenefits[]
healthPlans HealthPlan[]
rewardsPlan RewardsPlan @relation(fields: [rewardsPlanId], references: [id])
rewardsCodes RewardsCode[]
treatmentProviders TreatmentProvider[]
eligibilityFiles EligibilityFile[]
MemberBenefitsArchive MemberBenefitsArchive[]
@@index([rewardsPlanId])
@@map("contracts")
}
model TreatmentProvider {
id Int @id @default(autoincrement())
name String @unique(map: "treatment_providers.name_unique") @db.VarChar
contractId Int
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @db.Timestamptz(6)
members Member[] @relation
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
rewardsCodes RewardsCode[]
@@map("treatment_providers")
} |
Same issue here, I'm guessing it happens when using a |
Same here: → 131 const task = await prisma.task.findFirstOrThrow(
Inconsistent column data: Unexpected conversion failure from String(2023-12-07T09:18:30.111+00:00) to DateTime. Reason: $trailing input
❯ si.handleRequestError ../../packages/prisma-client/client/runtime/library.js:125:6817
❯ si.handleAndLogRequestError ../../packages/prisma-client/client/runtime/library.js:125:6151
❯ si.request ../../packages/prisma-client/client/runtime/library.js:125:5859
❯ l ../../packages/prisma-client/client/runtime/library.js:130:10025
❯ ../../packages/prisma-client/client/runtime/library.js:34:550
❯ src/controllers/v1/tasks/labels.controller.test.ts:131:20
129| userId: user.id,
130| });
131| const task = await prisma.task.findFirstOrThrow({
| ^
132| where: { id: tasks[0].id },
133| include: {
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'P2023', clientVersion: '5.7.0', meta: { modelName: 'Task', message: 'Unexpected conversion failure from String(2023-12-07T09:18:30.111+00:00) to DateTime. Reason: $trailing input' }, batchRequestIdx: undefined }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/2]⎯
Test Files 1 failed (1)
Tests 2 failed | 4 passed (6)
Start at 09:18:29
Duration 932ms (transform 176ms, setup 0ms, collect 558ms, tests 220ms, environment 0ms, prepare 52ms) Our task model: model Task {
...
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime @updatedAt @db.Timestamptz(3)
availableAt DateTime? @db.Timestamptz(3)
availableUntil DateTime? @db.Timestamptz(3)
...
} |
@janpio Yes. |
Can confirm this issue as well when |
removing the feature flag indeed fixes the issue. |
Apologies for the late reply, but can confirm that the error occurs regardless of Accelerate being used. As the others have figured out by now, it seems to be the usage of |
in my case it is the |
Thanks for the confirmations, super helpful. This definitely is the biggest and most popular thing we missed. Working on investigation and fix. @rajdtta Thanks for updating your message above as well, we were scared it leaked out of the preview feature - but we know that |
For sure, sorry for the mix-up w/ the initial report. I had forgotten to run |
Hey folks, So this is an oversight on my end for not handling native types. Most of them are going to fail atm: Either way, be sure it'll be available latest for the next release. If we release a patch, I'll make sure to let you know here. Meanwhile, I advise you to not use the preview feature just yet if you use native types. Don't get discouraged though, your reports are very useful for us to get joins on part with the old query-based mechanism. Thank you all 🙏 |
Inconsistent column data: Unexpected conversion failure from String to datetime. Reason: $trailing input
Hey, as promised, we are releasing a Thanks for the report again 🙏 |
Still appears with the neon serverless adapter |
Can you please open a new issue and optimally provide a reproduction @yovanoc? It Probably has a different root cause, but we will certainly want to fix that. Thanks. |
Bug description
I updated Prisma from v5.6 to v5.7 (to test out the experimental join feature). When the feature was enabled, my application started erroring with the following message:
How to reproduce
All I did was upgrade from Prisma v5.6 to v5.7. If I can figure out how to replicate the issue consistently from a sandbox, I'll follow up with an instruction set.
Expected behavior
I would expect these queries to execute w/o any issues given that they worked completely fine in the past.
Prisma information
Environment & setup
v21.2.0
Prisma Version
The text was updated successfully, but these errors were encountered: