Code
Frontend calls an API route that does not existcode.api-route-not-found
The code requests an /api/ path (or HTTP method) that no route in this Next.js app handles, so the call gets a 404 or 405 in production. This is common when the frontend and backend were generated separately and drifted: a renamed route, a different folder, a POST to a route that only exports GET.
- In force Rule code.api-route-not-found
- 3 clauses
At a glance
| Severity | medium |
|---|---|
| Certainty | Observed — the code as written is the problem |
| Looks at | your source code |
| When it runs | Runs on every scan |
How to fix it
Point the call at the route that exists, or create the missing handler: a file at app/api/<path>/route.ts that `export async function POST(req: Request) { … }` (one export per HTTP method).
Check your own app
Run npx scanlyfix scan in your project. Every finding gets an id; after fixing, npx scanlyfix verify <id> proves it is gone.
If it is a false positive in your project, silence that one line with // scanlyfix-ignore-next-line code.api-route-not-found -- <why>.
Your code stays
on your machine
Only findings are uploaded, and only to your own dashboard.
ScanlyFix
Security, privacy pages, SEO and AI visibility checked in one scan, with fixes your AI editor can apply.
Home