gatsbyjs/gatsby · error
There are routes that match both page and redirect. Pages ta
Error message
There are routes that match both page and redirect. Pages take precedence over redirects so the redirect will not work:\n${redirectMatchingPageWarnings} What it means
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).
Source
Thrown at packages/gatsby/src/bootstrap/redirects-writer.ts:48
redirectMatchingPageWarnings.push(
` - page: "${
hasSamePage ? redirect.fromPath : alternativePath
}" and redirect: "${redirect.fromPath}" -> "${redirect.toPath}"`
)
}
// Filter for redirects that are meant for the browser.
if (redirect.redirectInBrowser) {
browserRedirects.push({
...redirect,
fromPath: redirect.ignoreCase
? redirect.fromPath.toLowerCase()
: redirect.fromPath,
})
}
}
if (redirectMatchingPageWarnings.length > 0) {
reporter.warn(
`There are routes that match both page and redirect. Pages take precedence over redirects so the redirect will not work:\n${redirectMatchingPageWarnings.join(
`\n`
)}`
)
}
const newHash = await md5(JSON.stringify(browserRedirects))
if (newHash === lastHash) {
return
}
lastHash = newHash
await fs.writeFile(
joinPath(program.directory, `.cache/redirects.json`),
JSON.stringify(browserRedirects, null, 2)
)View on GitHub (pinned to e85d62f177)
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)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/gatsby/src/bootstrap/redirects-writer.ts:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26).
Data as JSON: /api/errors/9c37cd49dda0dd7e.
Report an issue: GitHub.