Path alias imports resolve to actual files
Why it matters
Path-alias hallucinations are one of the most common AI failure modes: the model writes import { calculateTax } from '@/lib/billing/calculator' for a file it imagined rather than a file that exists. The TypeScript compiler and the bundler both fail at the resolution step, so the build breaks and the route cannot render. Even when tsc --noEmit is skipped in CI, runtime imports via dynamic import() throw Cannot find module the first time the code path executes in production.
Severity rationale
High because an unresolved alias breaks the build or crashes the route at runtime, though a passing `tsc` step catches it before deploy.
Remediation
Run tsc --noEmit to surface every unresolved alias, then for each one decide whether to create the missing file or correct the import specifier. Fix the reference in place:
// Correct: points at a file that actually exists under src/lib/billing/
import { calculateTax } from '@/lib/billing/tax'
If the alias itself is wrong, update tsconfig.json compilerOptions.paths so the prefix maps to the real directory.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Hallucinated References Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-hallucinations·automated
- 2026-04-20·v1.1.0·Add Phase 6.1 detect-node snippet for deterministic path-alias resolution·by cakleinman