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.

by 주말개발자153

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.

by 호기심천국112 · ▲0

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.

by 무한도전러643 · ▲0

Well, that's a bit... Models these days have gotten a lot better than before, haven't they? I've barely seen models making up nonexistent functions over the past few months. If anything, I suspect it's an issue with the model or plugin settings you're using, but since you didn't mention what you're using, I can't really judge.

by 디지털노마드757 · ▲0

I really relate to this. Last year, while refactoring legacy code at work, Copilot made up a function from our internal utility module out of thin air. The name was so plausible that I thought it existed and opened a PR, only to have a reviewer ask, "Where is this?" and want to die of embarrassment lol.

Since then, whenever a function I don't recognize shows up in generated code, I always jump to its definition in the IDE first (Ctrl+Click). If it doesn't open, it simply doesn't exist. Ever since I made this a habit, I've wasted way less time. Also, if you write the tests first and make the code pass them, you'll never end up using a function that doesn't exist in the first place.

by 코딩하는곰219 · ▲0