Copilot keeps making up functions that don't exist: is it just me?
Seriously, yesterday and today alike, it just casually writes library functions that don't exist. It calls a method that isn't real and acts completely sure of itself lol
I copied it as-is and wasted 30 minutes. These days I've gotten into the habit of doubting it first.
4 answers
Lol, that's a hallucination. I lost my mind over it at first too, but now I just shrug it off as par for the course.
There’s a solution: just add this one line to your prompt — 'The library version I’m using is X.Y. If you use a non-existent API, explicitly tell me' — and it noticeably cuts down the problem. Also, always run generated code through a linter/type checker first. If there’s a function that doesn’t exist, it’ll catch it right there. After wasting 30 minutes two or three times, I made this a routine.