Was there some work-related reason you needed to tell this?
For example, “Be sure you don’t do XYZ today when you’re working. Joe and Jim did XYZ last week and both of them are in trouble for it, so we all need to be careful not to make that mistake. Pass the word.” Obviously the purpose here is not to harm the reputation of Joe and Jim but to make sure that people don’t repeat the work mistake, which could harm productivity or get someone disciplined.
Or another example, "Joe and Jim aren’t going to be working in here today because they got reassigned for making a mistake on the job. " Again, this isn’t to harm the reputation of Joe and Jim, it’s to let people know that Joe and Jim won’t be working.
Or another example, "Joe and Jim made this mistake last week and got reprimanded by the boss. How can we fix our process or train our workers better, so our workers don’t make the mistake again? "
It’s pretty normal to discuss work mistakes for some work-related purpose, such as warning others not to make the same mistake, or process improvement. If we never discussed mistakes made at work then we would be missing out on a lot of learning and improvement opportunities. So if you had a legitimate reason to discuss the mistake, and it wasn’t just to tell juicy stories about Joe and Jim, then don’t worry about it.