gatsbyjs/gatsby · error
[gatsby-react-router-scroll] Unable to access sessionStorage
Error message
[gatsby-react-router-scroll] Unable to access sessionStorage; sessionStorage is not available.
What it means
Browser warning from gatsby-react-router-scroll: window.sessionStorage.getItem threw (storage blocked by browser privacy settings or unavailable), so no saved scroll position exists and 0 is returned; printed only outside production.
Source
Thrown at packages/gatsby-react-router-scroll/src/session-storage.ts:14
import { Path } from "history"
const STATE_KEY_PREFIX = `@@scroll|`
const GATSBY_ROUTER_SCROLL_STATE = `___GATSBY_REACT_ROUTER_SCROLL`
export class SessionStorage {
read(location: Path, key: string): number {
const stateKey = this.getStateKey(location, key)
try {
const value = window.sessionStorage.getItem(stateKey)
return value ? JSON.parse(value) : 0
} catch (e) {
if (process.env.NODE_ENV !== `production`) {
console.warn(
`[gatsby-react-router-scroll] Unable to access sessionStorage; sessionStorage is not available.`
)
}
if (
window &&
window[GATSBY_ROUTER_SCROLL_STATE] &&
window[GATSBY_ROUTER_SCROLL_STATE][stateKey]
) {
return window[GATSBY_ROUTER_SCROLL_STATE][stateKey]
}
return 0
}
}
save(location: Path, key: string, value: number): void {
const stateKey = this.getStateKey(location, key)View on GitHub (pinned to e85d62f177)
Solutions
- Allow cookies/site storage in the browser
- Accept degraded scroll restoration when storage is unavailable
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/gatsby-react-router-scroll/src/session-storage.ts:14 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/7f7aba2039a51a82.
Report an issue: GitHub.