diff --git a/packages/next/errors.json b/packages/next/errors.json index 3015574ece7a..1c43354ba36d 100644 --- a/packages/next/errors.json +++ b/packages/next/errors.json @@ -1162,5 +1162,6 @@ "1161": "\"unstable_prefetch\" is a route segment config and can only be used when the segment is a Server Component module. Remove the \"use client\" directive from \"%s\" to use this API.", "1162": "Route \"%s\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`.", "1163": "Unexpected cache miss after cache warming phase during prerendering. This is likely caused by non-deterministic arguments that differ between the cache warming phase and the final prerender phase (e.g. unstable array order). Ensure that arguments passed to cached functions are deterministic.", - "1164": "Response body exceeded maximum size of %s bytes" + "1164": "Response body exceeded maximum size of %s bytes", + "1165": "You cannot use both a required and optional catch-all route at the same level (\"[...%s]\" and \"%s\" )." } diff --git a/packages/next/src/shared/lib/router/utils/sorted-routes.ts b/packages/next/src/shared/lib/router/utils/sorted-routes.ts index c83e8cf10353..5aafa12c4961 100644 --- a/packages/next/src/shared/lib/router/utils/sorted-routes.ts +++ b/packages/next/src/shared/lib/router/utils/sorted-routes.ts @@ -154,7 +154,7 @@ class UrlNode { if (isOptional) { if (this.restSlugName != null) { throw new Error( - `You cannot use both an required and optional catch-all route at the same level ("[...${this.restSlugName}]" and "${urlPaths[0]}" ).` + `You cannot use both a required and optional catch-all route at the same level ("[...${this.restSlugName}]" and "${urlPaths[0]}" ).` ) } diff --git a/test/unit/page-route-sorter.test.ts b/test/unit/page-route-sorter.test.ts index 1faa8ba0bd4b..07caf250914d 100644 --- a/test/unit/page-route-sorter.test.ts +++ b/test/unit/page-route-sorter.test.ts @@ -172,7 +172,7 @@ describe('getSortedRoutes', () => { expect(() => getSortedRoutes(['/[...one]', '/[[...one]]']) ).toThrowErrorMatchingInlineSnapshot( - `"You cannot use both an required and optional catch-all route at the same level ("[...one]" and "[[...one]]" )."` + `"You cannot use both a required and optional catch-all route at the same level ("[...one]" and "[[...one]]" )."` ) expect(() => getSortedRoutes(['/[[...one]]', '/[...one]'])