I looked at the source code and found out that if rule based notification is disabled
the api looks up a user attribute called ‘notification_method’ and for all the most users this field did not exists and the exception got thrown.
Fixed it be enabling rulebased notifications.