{"record":{"id":"7f7aba2039a51a82","repo":"gatsbyjs/gatsby","slug":"gatsby-react-router-scroll-unable-to-access-sess","errorCode":null,"errorMessage":"[gatsby-react-router-scroll] Unable to access sessionStorage; sessionStorage is not available.","messagePattern":"\\[gatsby-react-router-scroll\\] Unable to access sessionStorage; sessionStorage is not available\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-react-router-scroll/src/session-storage.ts","lineNumber":14,"sourceCode":"import { Path } from \"history\"\nconst STATE_KEY_PREFIX = `@@scroll|`\nconst GATSBY_ROUTER_SCROLL_STATE = `___GATSBY_REACT_ROUTER_SCROLL`\n\nexport class SessionStorage {\n  read(location: Path, key: string): number {\n    const stateKey = this.getStateKey(location, key)\n\n    try {\n      const value = window.sessionStorage.getItem(stateKey)\n      return value ? JSON.parse(value) : 0\n    } catch (e) {\n      if (process.env.NODE_ENV !== `production`) {\n        console.warn(\n          `[gatsby-react-router-scroll] Unable to access sessionStorage; sessionStorage is not available.`\n        )\n      }\n\n      if (\n        window &&\n        window[GATSBY_ROUTER_SCROLL_STATE] &&\n        window[GATSBY_ROUTER_SCROLL_STATE][stateKey]\n      ) {\n        return window[GATSBY_ROUTER_SCROLL_STATE][stateKey]\n      }\n\n      return 0\n    }\n  }\n\n  save(location: Path, key: string, value: number): void {\n    const stateKey = this.getStateKey(location, key)","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-react-router-scroll/src/session-storage.ts#L1-L32","documentation":"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.","triggerScenarios":"Thrown at packages/gatsby-react-router-scroll/src/session-storage.ts:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Allow cookies/site storage in the browser","Accept degraded scroll restoration when storage is unavailable"],"exampleFix":null,"handlingStrategy":"fallback","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-14T05:17:10.506Z"}