You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid Date passed to $queryRaw/$executeRaw is silently serialized as the string "null" instead of throwing #29696
Raw-parameter serialization tags dates via parameter.toJSON(), which returns null for an invalid Date (spec behavior). So an invalid Date becomes { prisma__type: 'date', prisma__value: null }; on deserialize it becomes the literal string "null" typed as datetime, silently corrupting the value — whereas the structured query builder throws a clear "Provided Date object is invalid".
Steps to reproduce
serializeRawParameters([newDate('not a date'),newDate('2024-01-15T00:00:00Z')])// -> [{"prisma__type":"date","prisma__value":null}, {"prisma__type":"date","prisma__value":"2024-01-15T00:00:00.000Z"}]// after deserialize -> args ["null", "2024-01-15T00:00:00.000Z"], both typed datetime
Observed: the invalid date is coerced to the string "null" and bound as a datetime. Expected: a validation error, as the non-raw path throws.
Root cause
packages/client/src/runtime/utils/serializeRawParameters.ts uses prisma__value: parameter.toJSON() in the isDate branch; deserializeRawParameters.ts then produces the literal "null".
Suggested fix
In the isDate branch, validate with the existing isValidDate helper and throw a clear client error for invalid dates instead of emitting toJSON().
Activity
Macy665 commentedon Jul 12, 2026
Hello 👋
fix(client): reject invalid Date in $queryRaw instead of serializing …
fix(client): reject invalid Date in $queryRaw instead of serializing …
fix(client): make invalid Date error a PrismaClientValidationError (#…
fix(client): make invalid Date error a PrismaClientValidationError (p…