What's the misunderstanding? The hallucinations I've seen from AI tend to not be that dissimilar to when humans are guessing. They will guess that a function like that exists. The difference being that humans are capable of checking their work and see if this actually is true by referencing some existing source of truth.