gatsbyjs/gatsby · error · Error

Could not find page by path: ${action.payload.path}

Error message

Could not find page by path: ${action.payload.path}

What it means

pagesReducer MATERIALIZE_PAGE_MODE looks up the page by action.payload.path before mutating page.mode; a missing entry means the redux store never had a page at that path — the action was dispatched for a deleted or never-created page.

Source

Thrown at packages/gatsby/src/redux/reducers/pages.ts:49

        )
      }

      // Add page to the state with the path as key
      state.set(action.payload.path, action.payload)

      return state
    }

    case `DELETE_PAGE`: {
      state.delete(action.payload.path)

      return state
    }

    case `MATERIALIZE_PAGE_MODE`: {
      const page = state.get(action.payload.path)
      if (!page) {
        throw new Error(`Could not find page by path: ${action.payload.path}`)
      }
      page.mode = action.payload.pageMode
      return state
    }

    default:
      return state
  }
}

View on GitHub (pinned to e85d62f177)

Solutions

  1. Ensure the page is created before mode materialization is dispatched
  2. Check for DELETE_PAGE races with dev-ssr/dsg materialization
  3. Report as a Gatsby bug if it happens with a normal build
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at packages/gatsby/src/redux/reducers/pages.ts:49 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/eb47e2c770adbfb6. Report an issue: GitHub.