Nope, you are fine, as you didn't have any way of knowing that the recipient ahd just bought themselves the same thing!
The only time I will offer/do this is with my mom. For christmas she asked for a new winter nightgown. She likes a particular style, and fabric, and as I got a good deal, I bought her two. She asked, and said to me, she only really needs one, but could I return it, and maybe get her one for summer, instead. Since its' my mom, and I live 8 hours away, it wasn't an issue at all. I returned the first one, and she's got an IOU for a different once, when they come out.
But anyone else, I'd let the giftee decide what to do, or if I'm given a duplicate gift, I figure out what to do with it. And when giving, whenver possible, I include a gift receipt, but in this case, it sounds like maybe it was a one of a kind item, so not possible to do that.