Next.js Discord

Discord Forum

Next.js 13 does not throw error when visiting unexisiting page

Unanswered
Brewer's Blackbird posted this in #help-forum
Open in Discord
Brewer's BlackbirdOP
When I visit an unexisiting page, for example "/doesnotexist", I get no error, it just displays the layout.

Here is the tree of my src directory:
│   env.mjs
│   middleware.ts
│
├───app
│   │   layout.tsx
│   │
│   ├───(auth)
│   │   │   layout.tsx
│   │   │
│   │   ├───signin
│   │   │       page.tsx
│   │   │
│   │   └───signout
│   │           page.tsx
│   │
│   ├───(core)
│   │   │   layout.tsx
│   │   │   page.tsx
│   │   │
│   │   └───[username]
│   │           page.tsx
│   │
│   └───api
│       └───auth
│           └───[...nextauth]
│                   route.ts
│
├───components
│   │   icons.tsx
│   │   tailwind-indicator.tsx
│   │
│   ├───layouts
│   │       site-header.tsx
│   │       site-nav.tsx
│   │       site-sidebar.tsx
│   │
│   ├───providers
│   │       theme-provider.tsx
│   │
│   └───ui
│           button.tsx
│           toast.tsx
│           toaster.tsx
│           use-toast.ts
│
├───config
│       site.ts
│
├───lib
│       auth.ts
│       db.ts
│       fonts.ts
│       utils.ts
│
└───styles
        globals.css

6 Replies

@Brewer's Blackbird When I visit an unexisiting page, for example "/doesnotexist", I get no error, it just displays the layout. Here is the tree of my src directory: cmd │ env.mjs │ middleware.ts │ ├───app │ │ layout.tsx │ │ │ ├───(auth) │ │ │ layout.tsx │ │ │ │ │ ├───signin │ │ │ page.tsx │ │ │ │ │ └───signout │ │ page.tsx │ │ │ ├───(core) │ │ │ layout.tsx │ │ │ page.tsx │ │ │ │ │ └───[username] │ │ page.tsx │ │ │ └───api │ └───auth │ └───[...nextauth] │ route.ts │ ├───components │ │ icons.tsx │ │ tailwind-indicator.tsx │ │ │ ├───layouts │ │ site-header.tsx │ │ site-nav.tsx │ │ site-sidebar.tsx │ │ │ ├───providers │ │ theme-provider.tsx │ │ │ └───ui │ button.tsx │ toast.tsx │ toaster.tsx │ use-toast.ts │ ├───config │ site.ts │ ├───lib │ auth.ts │ db.ts │ fonts.ts │ utils.ts │ └───styles globals.css
if I am not wrong that route matches your username route
Brewer's BlackbirdOP
ohhhh, shiii, thx dawg, that's what i was afraid of
i been thinking bout that and didnt even notice that i accidentally done that shi
bruh
thank man
@Brewer's Blackbird thank man
np, just mark this thread as solved