I just got the same problem on a piece of code that was otherwise running flawlessly.
The difference is that I was concatenating rather than summing the embedding.
I figured out that the error appeared when the size of the embedding is too small.
I mean, not the dimension but the number of item to embed.
In my case, embedding 4 items was problematic, in fact it was up to 13 but 14 worked fine.
So I just added 10 dummy tokens.
What is weird indeed is that the error only appears when you start to use those embedding in cat or sim.
Maybe someone knows why small embeddings are a problem.
Best