{"record":{"id":"9c37cd49dda0dd7e","repo":"gatsbyjs/gatsby","slug":"there-are-routes-that-match-both-page-and-redirect","errorCode":null,"errorMessage":"There are routes that match both page and redirect. Pages take precedence over redirects so the redirect will not work:\\n${redirectMatchingPageWarnings}","messagePattern":"There are routes that match both page and redirect\\. Pages take precedence over redirects so the redirect will not work:\\\\n(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/bootstrap/redirects-writer.ts","lineNumber":48,"sourceCode":"      redirectMatchingPageWarnings.push(\n        ` - page: \"${\n          hasSamePage ? redirect.fromPath : alternativePath\n        }\" and redirect: \"${redirect.fromPath}\" -> \"${redirect.toPath}\"`\n      )\n    }\n    // Filter for redirects that are meant for the browser.\n    if (redirect.redirectInBrowser) {\n      browserRedirects.push({\n        ...redirect,\n        fromPath: redirect.ignoreCase\n          ? redirect.fromPath.toLowerCase()\n          : redirect.fromPath,\n      })\n    }\n  }\n\n  if (redirectMatchingPageWarnings.length > 0) {\n    reporter.warn(\n      `There are routes that match both page and redirect. Pages take precedence over redirects so the redirect will not work:\\n${redirectMatchingPageWarnings.join(\n        `\\n`\n      )}`\n    )\n  }\n\n  const newHash = await md5(JSON.stringify(browserRedirects))\n\n  if (newHash === lastHash) {\n    return\n  }\n\n  lastHash = newHash\n\n  await fs.writeFile(\n    joinPath(program.directory, `.cache/redirects.json`),\n    JSON.stringify(browserRedirects, null, 2)\n  )","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/bootstrap/redirects-writer.ts#L30-L66","documentation":"Fires in writeRedirects during bootstrap when a redirect's fromPath collides with a generated page route. Since Gatsby serves the page first, the redirect is dead configuration; the warning lists each colliding page/redirect pair (also flagging case-insensitive duplicates of the same path).","triggerScenarios":"Thrown at packages/gatsby/src/bootstrap/redirects-writer.ts:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the redirect's fromPath to a route not occupied by a real page","Remove the redirect if the page already covers the route","Fix casing mismatches between fromPath and the page path (redirects are often lowercased via ignoreCase)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}