I don’t know why you think that that example has any “grammatical” error in it. As far as English grammar goes, it is impeccable. It’s not that it’s ungrammatical so much as that it may be ungainly. It’s like with saying it’s something that you do do, or there’s ours and there’s theirs, or that you like like things more than you like unlike ones, or that he asked me to tomorrow, or he said yes yesterday. These things happen, and sometimes they’re completely unavoidable.
There is nothing fundamentally or theoretically “wrong” with having the same “word” twice in a row in English. These things inevitably happen, both with duplicate words and with sequences of homophones.
However, these repetitions can sometimes become awkward either to read, to speak, or both. This is one of those cases where phrasally it is hard to enunciate it both clearly and naturally, for reasons more complex than are worth delving into too deeply.
If it feels awkward to you, then by all means rephrase it. But this is not a matter of grammar or rules, just of clarity and convenience.