Route handler files only export valid Next.js convention names
Why it matters
Next.js App Router route handlers that export non-conventional names — handler, default, loader — are silently ignored by the framework. The file appears to have an endpoint but HTTP requests return 405 Method Not Allowed or fall through to the next handler with no warning, no build error, and no runtime log. This reference-integrity gap makes the failure invisible: your API contract says the route exists, but no code runs. The taxon code-quality understates the operational impact — a hallucinated export name deletes the handler entirely from the request lifecycle.
Severity rationale
Medium because the route silently stops working rather than exposing a security vulnerability, but the debugging surface is near-zero without knowing the allowlist.
Remediation
Rename every export in app/**/route.ts files to match a valid HTTP method or accepted Next.js config name. The complete allowlist is: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, dynamic, dynamicParams, revalidate, fetchCache, runtime, preferredRegion, maxDuration, generateStaticParams.
// app/api/users/route.ts
// Bad — 'handler' is ignored by Next.js App Router
export async function handler(req: Request) {
return Response.json({ ok: true })
}
// Good — export the HTTP method name
export async function GET(req: Request) {
return Response.json({ ok: true })
}
export async function POST(req: Request) {
const body = await req.json()
// ...
return Response.json({ created: true }, { status: 201 })
}
Pages Router patterns (export default, getServerSideProps) are invalid in App Router route files.
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.
External references
- iso-25010:2011 · maintainability.analysability — Maintainability — Analysability: misrouted exports are silent failures that resist diagnosis
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-hallucinations·automated