gatsbyjs/gatsby · error
Non-fatal: Deleting the old cache folder failed, left behind
Error message
Non-fatal: Deleting the old cache folder failed, left behind in `${bakName}`. Rimraf reported this error: ${e} What it means
Non-fatal warning in writeToCache: the redux cache folder swap succeeded but rimraf failed deleting the old .cache backup, so the previous cache remains on disk under the shown .bak name. Harmless disk residue, the fresh cache is already in place.
Source
Thrown at packages/gatsby/src/redux/persist.ts:262
const reduxCacheFolder = getReduxCacheFolder()
let bakName = ``
if (existsSync(reduxCacheFolder)) {
// Don't drop until after swapping over (renaming is less likely to fail)
bakName = safelyRenameToBak(reduxCacheFolder)
}
// The redux cache folder should now not exist so we can rename our tmp to it
moveSync(tmpDir, reduxCacheFolder)
// Now try to yolorimraf the old cache folder
try {
if (bakName !== ``) {
removeSync(bakName)
}
} catch (e) {
report.warn(
`Non-fatal: Deleting the old cache folder failed, left behind in \`${bakName}\`. Rimraf reported this error: ${e}`
)
}
}
View on GitHub (pinned to e85d62f177)
Solutions
- Delete the leftover .bak folder manually
- Check permissions or processes locking the directory (antivirus, editors) if it repeats
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/gatsby/src/redux/persist.ts:262 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/329f4e9c453c968d.
Report an issue: GitHub.