I get this issue when I add a new user. I've been looking for this problem and some people suggest to restore default user preferences. I did it whith no results.
This error appears after upgrade to Moodle 3.9 and I don't know how to solve it.
Thanks a lot in advance.