nextjs
config_error
ai_generated
true
Error: The slot '@slot' is missing the required 'default.tsx' file. Ensure the slot has a default export.
ID: nextjs/parallel-route-slot-not-found
95%Fix Rate
85%Confidence
1Evidence
2023-10-27First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Next.js 14.0.0 | active | — | — | — |
| Next.js 14.1.0 | active | — | — | — |
| Next.js 14.2.0 | active | — | — | — |
Root Cause
A parallel route slot in the app directory must have a default.tsx file to render when no matching route is found; otherwise, Next.js throws this error to enforce fallback behavior.
generic中文
app 目录中的并行路由插槽必须有一个 default.tsx 文件,以便在找不到匹配路由时渲染;否则 Next.js 会抛出此错误以强制回退行为。
Official Documentation
https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#defaultjsWorkarounds
-
95% success Create a default.tsx file in the slot directory that exports a default component, e.g., 'export default function Default() { return null; }'
Create a default.tsx file in the slot directory that exports a default component, e.g., 'export default function Default() { return null; }' -
85% success Use a catch-all route like '[[...slug]]' inside the slot folder with a page.tsx that handles all unmatched paths, but still ensure default.tsx exists for the slot root.
Use a catch-all route like '[[...slug]]' inside the slot folder with a page.tsx that handles all unmatched paths, but still ensure default.tsx exists for the slot root.
-
90% success If the slot is not needed, remove all references to it from layout.tsx and delete the slot folder.
If the slot is not needed, remove all references to it from layout.tsx and delete the slot folder.
中文步骤
Create a default.tsx file in the slot directory that exports a default component, e.g., 'export default function Default() { return null; }'Use a catch-all route like '[[...slug]]' inside the slot folder with a page.tsx that handles all unmatched paths, but still ensure default.tsx exists for the slot root.
If the slot is not needed, remove all references to it from layout.tsx and delete the slot folder.
Dead Ends
Common approaches that don't work:
-
70% fail
Layout.tsx is used for shared layouts, not as a fallback render for unmatched routes; the slot still needs default.tsx.
-
90% fail
Removing the slot breaks the parallel route structure; use default.tsx to keep the slot functional.
-
80% fail
Page.tsx only works for the root segment of the slot; default.tsx is specifically required for fallback rendering.