Skip to content

sorted-routes: fix "an required" → "a required" grammar in catch-all error#92937

Open
yogeshwaran-c wants to merge 1 commit intovercel:canaryfrom
yogeshwaran-c:fix/an-required-catch-all-typo
Open

sorted-routes: fix "an required" → "a required" grammar in catch-all error#92937
yogeshwaran-c wants to merge 1 commit intovercel:canaryfrom
yogeshwaran-c:fix/an-required-catch-all-typo

Conversation

@yogeshwaran-c
Copy link
Copy Markdown

What?

Fix the article in the "required + optional catch-all at the same level" error from sorted-routes.ts. Today users see:

```
You cannot use both an required and optional catch-all route at the same level
("[...one]" and "[[...one]]" )
```

required starts with a consonant sound, so the article should be "a", not "an".

Why?

Reported as part of #68933 — the issue body quotes the error verbatim and the typo is right there in sorted-routes.ts:157. The other direction of the same error already uses correct grammar ("an optional and required catch-all"), and a sibling error later in errors.json (entry 911 — "a required and optional catch-all route at the same level in route") already uses the corrected wording. This entry was the odd one out.

It's purely a string fix — the matching test in page-route-sorter.test.ts already pinned the buggy wording via toThrowErrorMatchingInlineSnapshot, so it's been a regression-stable typo for a while.

How?

  • Updated the literal in packages/next/src/shared/lib/router/utils/sorted-routes.ts:157.
  • Updated the matching inline snapshot in test/unit/page-route-sorter.test.ts.
  • Let pnpm build regenerate the corresponding errors.json entry (new id 1165), which is how the repo manages these strings.

No behavior change — only the wording.

Test plan

  • npx jest test/unit/page-route-sorter.test.ts — 15 passed, 19 snapshots passed (including the updated one for this error path).

Reported in #68933.

…error

The "required + optional catch-all at the same level" error read

    You cannot use both an required and optional catch-all route at the
    same level ...

The article should be "a", not "an" (`required` starts with a consonant
sound). The other direction of the same error already uses correct
grammar — "an optional and required catch-all" — and a sibling error
later in `errors.json` (entry 911) already uses "a required and
optional", so this entry was the odd one out.

Updated the source string, the matching `toThrowErrorMatchingInlineSnapshot`
in `test/unit/page-route-sorter.test.ts`, and let `pnpm build` regenerate
the corresponding `errors.json` entry.

Reported as part of vercel#68933.
@yogeshwaran-c yogeshwaran-c marked this pull request as ready for review April 17, 2026 11:02
@nextjs-bot
Copy link
Copy Markdown
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: ca10eb3

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants