Hallucinated Imports

Imports of packages not in package.json (AI hallucinations)

criticalReliabilityhallucinated-imports

Why this matters

AI tools confidently import packages that don't exist or have different names. The code looks correct but crashes immediately at runtime because the module isn't found.

Bad
// AI hallucinated this package name
import { formatCurrency } from "next/currency";
import { useOptimistic } from "react-optimistic";
Good
// Real packages that exist in package.json
import { formatCurrency } from "@/lib/format";
import { useOptimistic } from "react";

How to fix

Verify every import exists in your package.json. Run your code — hallucinated imports crash immediately. Check npm to confirm the package name is real.

All rules