The fact that it’s happening only sometimes indicates that your input actually varies (subtly) from time to time.
It depends on what kind of keyboard you have, but I think it’s likely that you’re accidentally holding down the Alt key while you type the space after the pipe. Alt+Space is a non-breaking space, which zsh won’t recognise.