Skip to content

Routing conflict not detected in nested groups #13704

Open
@philippone

Description

@philippone

Describe the bug

I run into this issue by using the awesome vite-plugin-kit-routes. The issue describes the same problem but I guess Sveltekit should complain about conflicting routes to solve the issue.

I have the following route structure:

routes
└── (group)
    └── base
        ├── +page.svelte
        └── (optional-group)
            └── [[optionalParam]]
                └── +page.svelte

This generates the following routes

  • (group)/base
  • (group)/base/(optional-group)/[[optionalParam]]

(Un)Fortunately, the paths are actually resolving the correct page.svelte

  • /base -> (group)/base
  • /base/myparam -> (group)/base/(optional-group)/[[optionalParam]]

If I remove one of the groups, (group) or (optional-group), I got the following error message:

The "/base" and "/base/(optional-group)/[[optionalParam]]" routes conflict with each other

I guess the error should also appear when using the groups?

To use this route structure correctly

  • change [[optionalParam]] to [requiredParam]
  • remove the conflicting page (group)base/+page.ts

Reproduction

https://stackblitz.com/edit/sveltejs-kit-page-groupted-duplicate?file=README.md

Logs

System Info

System:
    OS: macOS 15.4
    CPU: (10) arm64 Apple M1 Max
    Memory: 511.97 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    Yarn: 3.6.3 - ~/.nvm/versions/node/v22.12.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
  Browsers:
    Chrome: 135.0.7049.85
    Safari: 18.4
  npmPackages:
    @sveltejs/kit: 2.20.4 => 2.20.4 
    @sveltejs/vite-plugin-svelte: 5.0.3 => 5.0.3 
    svelte: 5.25.7 => 5.25.7 
    vite: 6.2.5 => 6.2.5

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions