79626991

Date: 2025-05-17 21:14:26
Score: 2
Natty:
Report link

Check your where condition — it should not be an empty string. It requires a proper column name.

For example, somewhere you might be using an empty where clause like '', which causes the error.
Try to use single inverted comma ' ' properly.

In my case, I was using this in an association, and that's why I was getting the error:

//gives me error
include: [{
  model: User,
  as: 'owner',
  attributes: ['userId', '']
}]


//corrected code
include: [{
  model: User,
  as: 'owner',
  attributes: ['userId']
}]
Reasons:
  • Blacklisted phrase (2): gives me error
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Baljit Singh