This happens when:
- Some post of a topic contains a mention, and
- The mentioned user has user status set, and
- That status has an end date
If an anonymous user tries to load such a topic, this error happens.
And here is the fix:
https://github.com/discourse/discourse/pull/20660