gatsbyjs/gatsby · error

Error persisting state: ${(err && err.message) || err}

Error message

Error persisting state: ${(err && err.message) || err}

What it means

Non-fatal warning from Gatsby's redux persistence layer: serializing the app state (redux.saveState) to disk failed. The caught error's message is inlined. Builds continue with in-memory state, but the next cold start loses .cache state and must rebuild it.

Source

Thrown at packages/gatsby/src/redux/save-state.js:12

const report = require(`gatsby-cli/lib/reporter`)
const redux = require(`./`)

let saveInProgress = false
async function saveState() {
  if (saveInProgress) return
  saveInProgress = true

  try {
    await redux.saveState()
  } catch (err) {
    report.warn(`Error persisting state: ${(err && err.message) || err}`)
  }

  saveInProgress = false
}

module.exports = {
  saveState,
}

View on GitHub (pinned to e85d62f177)

Solutions

  1. Check disk space and write permissions on the .cache directory
  2. Run `gatsby clean` and rebuild
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/gatsby/src/redux/save-state.js:12 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/e39446a91dd5d4a9. Report an issue: GitHub.