{"record":{"id":"c716d31730e3b6ec","repo":"withastro/astro","slug":"error-generating-routes-normalized-error-messag","errorCode":null,"errorMessage":"Error generating routes: ${normalized.error.message}","messagePattern":"Error generating routes: (.+?)","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/integrations/vercel/src/index.ts","lineNumber":629,"sourceCode":"\t\t\t\t\t\tdomains:\n\t\t\t\t\t\t\timagesConfig.domains || _config.image.domains\n\t\t\t\t\t\t\t\t? [...(imagesConfig.domains ?? []), ...(_config.image.domains ?? [])]\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tremotePatterns: [...(imagesConfig.remotePatterns ?? [])],\n\t\t\t\t\t};\n\t\t\t\t\tconst remotePatterns = _config.image.remotePatterns;\n\t\t\t\t\tfor (const pattern of remotePatterns) {\n\t\t\t\t\t\tif (isAcceptedPattern(pattern)) {\n\t\t\t\t\t\t\timages.remotePatterns?.push(pattern);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (imageService) {\n\t\t\t\t\timages = getDefaultImageConfig(_config.image);\n\t\t\t\t}\n\n\t\t\t\tconst normalized = normalizeRoutes([...(redirects ?? []), ...finalRoutes]);\n\t\t\t\tif (normalized.error) {\n\t\t\t\t\tthrow new AstroError(\n\t\t\t\t\t\t`Error generating routes: ${normalized.error.message}`,\n\t\t\t\t\t\tnormalized.error.link\n\t\t\t\t\t\t\t? `${normalized.error.action ?? 'More info'}: ${normalized.error.link}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (_routeToHeaders && _routeToHeaders.size > 0) {\n\t\t\t\t\tif (!normalized.routes) {\n\t\t\t\t\t\tnormalized.routes = [];\n\t\t\t\t\t}\n\t\t\t\t\tif (staticHeaders) {\n\t\t\t\t\t\tconst routesWithConfigHeaders = createRoutesWithStaticHeaders(_routeToHeaders, _config);\n\t\t\t\t\t\tconst fileSystemRouteIndex = normalized.routes.findIndex(\n\t\t\t\t\t\t\t(r) => 'handle' in r && r.handle === 'filesystem',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnormalized.routes.splice(fileSystemRouteIndex, 0, ...routesWithConfigHeaders);\n\t\t\t\t\t}","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/withastro/astro/blob/3578d45d34226d63cff3d261c971c221de6794d2/packages/integrations/vercel/src/index.ts#L611-L647","documentation":"After merging generated redirects and your final route list, the Vercel adapter runs `normalizeRoutes` to produce the final Vercel routes manifest. If normalization fails (an error object is returned instead of routes), the adapter throws this AstroError wrapping the underlying message. It means the combined route set — your pages plus generated redirects — is not representable in Vercel's routing config.","triggerScenarios":"A page filename whose dynamic segments produce an invalid route pattern (e.g. `[foo-bar]`, nested spread params like `[...a].[...b]`), or routes that conflict once redirects are prepended to the list during `astro build` with the Vercel adapter.","commonSituations":"Renaming a page to a bracket pattern containing dashes or invalid characters; upgrading the Vercel adapter to a version with stricter route normalization; having a redirect whose source collides with an existing dynamic page route.","solutions":["Read the wrapped `normalized.error.message` — it identifies the specific route that failed","Audit `src/pages/` bracket segments: params must match /^[a-zA-Z0-9_$]+$/ and spreads must be `[...name]`","Rename or remove the conflicting redirect/page pair if the error mentions a collision","Reproduce with `astro build` after each route change to catch the failing file quickly"],"exampleFix":"// before: src/pages/blog/[post-slug].astro\n\n// after: src/pages/blog/[slug].astro","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (e instanceof AstroError && e.message.startsWith('Error generating routes')) {\n    // audit src/pages bracket segments and redirect sources named in e.message\n  }\n  throw e;\n}","preventionTips":["Name dynamic params with plain identifiers: [slug], [id], [...path]","Avoid introducing regex fragments in filenames unless using the documented custom-syntax form","Run the adapter's build locally before deploying route changes"],"tags":["vercel","routing","build","normalize-routes"],"backgroundTag":"invalid-route-configuration","analyzedSha":"3578d45d34226d63cff3d261c971c221de6794d2","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}