Diagnostics
LUM5002: Invalid route file
A file under src/routes is not a valid route file.
Severity: error · Category: routing and server (5xxx)
Reported by: the route scanner (lumiose check, typegen, dev server).
#What it means
Route files use the Next.js App Router names: page.stsx/page.tsx, route.ts, and the
layout, not-found and error component files. Any other file in src/routes is a colocated
module that the router ignores, and so is everything below a private _folder. The message says
which rule a route file broke, for example:
- a special file with the wrong extension:
page.ts,layout.ts, orroute.tsx(an endpoint isroute.ts); - a Next.js special file Lumiose does not have:
loading,template,defaultorglobal-error, a route file below an@slotfolder (parallel routes) or a(.),(..)or(...)folder (intercepting routes); - an invalid segment folder (
[],[a-b],post-[id], a broken(group, unsafe characters), a rest segment that is not the last one, or a param used twice; export const modethat is not a string literal ofstatic,serverorspa, orssrthat is nottrue/false, orletinstead ofconst;export const localesthat is not a list of locale literals,"all"or a function, or that lists a localelumiose({ i18n })does not configure (Internationalization);- a warning for an export that has no effect:
ssr = falseoutsidesparoutes,prerenderin an endpoint or in a layout or page whose mode isstaticorserver(aspalayout'sprerenderapplies to the pages below it), orlocaleswithoutlumiose({ i18n }).
#Example
src/routes/blog/loading.stsx Lumiose has no loading files
src/routes/@modal/page.stsx Lumiose has no parallel routes
src/routes/api/route.tsx an endpoint is a route.ts file#How to fix it
Follow the help text. Show pending UI with <Suspense fallback={…}> instead of loading, use a
layout instead of template, rename the folder or file, and declare export const mode = "server"; with a literal. To keep a file next to the routes without the router reading it, give
it another name or move it into a _folder.