{"record":{"id":"0e36911a18fc53ac","repo":"sveltejs/kit","slug":"the-route-id-and-existing-route-id-routes-mu","errorCode":null,"errorMessage":"The ${route.id} and ${existing.route_id} routes must be merged into a single function that matches the ${route.pattern} regex, but they have incompatible configs. You must either rename one of the routes, or make their configs match.","messagePattern":"The (.+?) and (.+?) routes must be merged into a single function that matches the (.+?) regex, but they have incompatible configs\\. You must either rename one of the routes, or make their configs match\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-vercel/index.js","lineNumber":144,"sourceCode":"\t\t\t\t\t}\n\n\t\t\t\t\tisr_config.set(route, {\n\t\t\t\t\t\texpiration: config.isr.expiration,\n\t\t\t\t\t\tbypassToken: config.isr.bypassToken,\n\t\t\t\t\t\tallowQuery: ['__pathname', ...(config.isr.allowQuery ?? [])],\n\t\t\t\t\t\tgroup: isr_config.size + 1,\n\t\t\t\t\t\tpassQuery: true\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst hash = hash_config(config);\n\n\t\t\t\t// first, check there are no routes with incompatible configs that will be merged\n\t\t\t\tconst pattern = route.pattern.toString();\n\t\t\t\tconst existing = conflicts.get(pattern);\n\t\t\t\tif (existing) {\n\t\t\t\t\tif (existing.hash !== hash) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`The ${route.id} and ${existing.route_id} routes must be merged into a single function that matches the ${route.pattern} regex, but they have incompatible configs. You must either rename one of the routes, or make their configs match.`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconflicts.set(pattern, { hash, route_id: route.id });\n\t\t\t\t}\n\n\t\t\t\t// then, create a group for each config\n\t\t\t\tconst id = config.split ? `${hash}-${groups.size}` : hash;\n\t\t\t\tlet group = groups.get(id);\n\t\t\t\tif (!group) {\n\t\t\t\t\tgroup = { i: groups.size, config, routes: [] };\n\t\t\t\t\tgroups.set(id, group);\n\t\t\t\t}\n\n\t\t\t\tgroup.routes.push(route);\n\t\t\t}\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-vercel/index.js#L126-L162","documentation":"When two routes compile to the same URL-matching regex, Vercel must merge them into a single serverless function. If their hashed configs (runtime, isr settings, etc.) differ, the adapter cannot pick one and throws, telling you to rename a route or align configs.","triggerScenarios":"During adapt(), two routes in builder.routes produce the same `route.pattern` source string but different config hashes — e.g. `/[category]` and `/[slug]` both matching the same pattern with different isr or runtime settings.","commonSituations":"A dynamic route and a rest/optional route whose regexes coincide; restructuring routes so two params yield identical match patterns; one route has isr config and its regex-twin does not.","solutions":["Make the configs of the conflicting routes identical (same runtime, same isr settings)","Rename one of the routes (e.g. change the param name or path segment) so the patterns differ","Add a distinct path segment to disambiguate the routes","Use `builder` logs / the error message's route ids to locate both files and compare their exported `config`"],"exampleFix":"// before: routes/[slug]/+page.js has isr, routes/[id]/+page.js has none\n// after: give both identical configs or rename one route\neexport const config = { isr: { expiration: 60 } }; // in both route files","handlingStrategy":"validation","validationCode":"// sanity: two route ids whose regex sources collide need identical configs\nconst byPattern = new Map();\nfor (const r of routes) {\n  const p = r.pattern.toString();\n  if (byPattern.has(p) && hashConfig(r.config) !== byPattern.get(p)) {\n    throw new Error(`Incompatible configs share pattern ${p}`);\n  }\n  byPattern.set(p, hashConfig(r.config));\n}","typeGuard":"const configsCompatible = (a, b) => JSON.stringify(normalize(a)) === JSON.stringify(normalize(b));","tryCatchPattern":"try {\n  await build();\n} catch (err) {\n  if (err.message.includes('must be merged into a single function')) {\n    console.error('Align configs or rename one of the two routes named in the error.');\n  }\n  throw err;\n}","preventionTips":["Avoid overlapping dynamic segments ([slug] vs [id] at the same level)","Keep identical isr/runtime settings on regex-equivalent routes","Add distinct literal path segments to disambiguate routes","Review route changes that add params near existing dynamic routes"],"tags":["config","vercel","routes","conflict"],"backgroundTag":"route-config-conflict","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}