{"record":{"id":"b34afcff051004be","repo":"withastro/astro","slug":"a-collision-will-result-in-a-hard-error-in-followi","errorCode":null,"errorMessage":"A collision will result in a hard error in following versions of Astro.","messagePattern":"A collision will result in a hard error in following versions of Astro\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/astro/src/core/routing/create-manifest.ts","lineNumber":689,"sourceCode":"\tconst segmentCount = a.segments.length;\n\n\tfor (let index = 0; index < segmentCount; index++) {\n\t\tconst segmentA = a.segments[index];\n\t\tconst segmentB = b.segments[index];\n\n\t\tif (!isSemanticallyEqualSegment(segmentA, segmentB)) {\n\t\t\t// If any segment is not semantically equal between the routes\n\t\t\t// it is not certain that the routes collide.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Both routes are guaranteed to collide such that one will never be matched.\n\tlogger.warn(\n\t\t'router',\n\t\t`The route \"${a.route}\" is defined in both \"${a.component}\" and \"${b.component}\" using SSR mode. A dynamic SSR route cannot be defined more than once.`,\n\t);\n\tlogger.warn('router', 'A collision will result in a hard error in following versions of Astro.');\n}\n\n/**\n * Create a full route manifest from filesystem and injected routes.\n */\nexport async function createRoutesList(\n\tparams: CreateRouteManifestParams,\n\tlogger: AstroLogger,\n\t{\n\t\tdev = false,\n\t}: {\n\t\tdev?: boolean;\n\t} = {},\n): Promise<RoutesList> {\n\tconst { settings } = params;\n\tconst { config } = settings;\n\t// Create a map of all routes so redirects can refer to any route\n\tconst routeMap = new Map();","sourceCodeStart":671,"sourceCodeEnd":707,"githubUrl":"https://github.com/withastro/astro/blob/e294953aa8aadd98d5be92e60a03037b05dbdfd4/packages/astro/src/core/routing/create-manifest.ts#L671-L707","documentation":"While building the route manifest, Astro detects two routes whose patterns are semantically identical (same segments, same dynamic shape) in SSR mode. Because the first matching route always wins, the second can never be reached, so Astro warns the route is defined in both components and that a collision will become a hard error in a following version. Today it is a warning; the shadowed route silently never renders.","triggerScenarios":"A filesystem route like src/pages/[...slug].astro plus an integration-injected route with the same pattern; two injected routes whose patterns normalize to the same shape; hybrid setups where pages and custom integrations overlap.","commonSituations":"Adding an integration (admin panel, docs generator) that injects a catch-all over your own catch-all; upgrading Astro versions where this check was tightened; refactoring pages into injected routes without removing the originals.","solutions":["Look at the two components named in the warning line above — decide which route should own the pattern","Rename or scope one route (e.g., narrow the catch-all with a prefix like /blog/[...slug])","If an integration injects the duplicate, check its docs for configuring a different route pattern","Fix it now: the same collision hard-errors in following Astro versions"],"exampleFix":"// before: two owners of the same SSR pattern\nsrc/pages/[...slug].astro            // filesystem\n+ integration injects '/[...slug]'   // duplicate\n\n// after: only one route owns the pattern\nsrc/pages/blog/[...slug].astro        // scoped","handlingStrategy":"validation","validationCode":"// astro.config.mjs (integration) — fail the build on pattern collisions instead of warning\nhooks: {\n  'astro:routes:resolved': ({ routes }) => {\n    const seen = new Map();\n    for (const r of routes) {\n      if (seen.has(r.pattern)) throw new Error(`Duplicate route ${r.pattern}: ${seen.get(r.pattern)} vs ${r.component}`);\n      seen.set(r.pattern, r.component);\n    }\n  },\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep exactly one catch-all route pattern; scope extras under prefixes","When adding integrations that inject routes, grep their docs for injected patterns and deconflict","Grep build logs for 'defined in both' in CI — a future Astro version makes it a hard error"],"tags":["routing","ssr","manifest","deprecation"],"backgroundTag":"duplicate-route-collision","analyzedSha":"e294953aa8aadd98d5be92e60a03037b05dbdfd4","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}