Souds like something non-obvious. My best guess is something like. . . well. I don’t have a best guess.
Maybe the query is somehow returning those topics twice somehow? You might try adding a .where ID=123 to the query that’s getting the topics to see if it’s somehow getting it twice and then figure out why.