Next.js Discord

Discord Forum

Can't I have a page.tsx inside a route group?

Answered
Silver carp posted this in #help-forum
Open in Discord
Silver carpOP
I didn't find anything in the documentation about this
https://github.com/orgs/vercel/discussions/3580
Answered by Plague
you need to either remove the page.tsx inside the (app) folder or the one outside of it they are conflicting.
View full answer

13 Replies

Silver carpOP
How could I better structure the files to avoid this error?
Can you show the whole folder structure? From the screenshot it looks like you don't have an entry point for / (your home page) nvm idea-mangagement being highlighted threw me off, you do have an entry point which is the page.tsx you have in the screenshot
Silver carpOP
Ah okay there is the issue, you have two page.tsx's at the same route segment level
(app) is purely organizational, it doesn't affect the URL path so the page.tsx inside (app) is still your entry point / the one outside are conflicting with the ones inside or vice versa depending on the behavior you are looking for
you need to either remove the page.tsx inside the (app) folder or the one outside of it they are conflicting.
Answer
Silver carpOP
So should I delete src/page.tsx, keep src/layout.tsx and keep the layout within the groups, with each group not having page.tsx?
The layouts are fine
Only issue is the page.tsx files
Silver carpOP
I see, I will fix it
Thanks!
No problem