Sorry for being brief in my last message. You can repro it with no other customisations if you disable the basic badge and create a post with a new user. The code assumes that every user has at least one badge.
Here’s a fix: Handle no badges by angusmcleod · Pull Request #1 · discourse/discourse-post-badges · GitHub