Training data skews toward older versions. The most-documented version of any library is rarely the current one — it is the version that had the most tutorials, Stack Overflow answers, and blog posts written about it, which takes time to accumulate. A model trained today still knows React 17 and Next.js 13 better than it knows their latest releases.
This is not a fixable model problem. The agent cannot see your package.json. It does not know you are on Prisma 6, not Prisma 5. Without an explicit signal, it will write code that is plausibly correct against the version it knows best — which may not be the version you are running.
The solution is to include version context in the lookup. Context7 makes that explicit and automatic: resolve the library, specify the version, get documentation from that release.