gatsbyjs/gatsby · error
Neither "cache" or "getCache" was passed. getCache must be f
Error message
Neither "cache" or "getCache" was passed. getCache must be function that return Gatsby cache, "cache" must be the Gatsby cache, was ${typeof cache} What it means
The gatsby-source-wordpress createRemoteFileNode copy requires a cache (or getCache). After the getCache fallback resolves, if cache is still not an object this error fires. The plugin caches downloaded media across builds to avoid refetching.
Source
Thrown at packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js:418
}
// validation of the input
// without this it's notoriously easy to pass in the wrong `createNodeId`
// see gatsbyjs/gatsby#6643
if (typeof createNodeId !== `function`) {
throw new Error(
`createNodeId must be a function, was ${typeof createNodeId}`
)
}
if (typeof createNode !== `function`) {
throw new Error(`createNode must be a function, was ${typeof createNode}`)
}
if (typeof getCache === `function`) {
// use cache of this plugin and not cache of function caller
cache = getCache(`gatsby-source-filesystem`)
}
if (typeof cache !== `object`) {
throw new Error(
`Neither "cache" or "getCache" was passed. getCache must be function that return Gatsby cache, "cache" must be the Gatsby cache, was ${typeof cache}`
)
}
// Check if we already requested node for this remote file
// and return stored promise if we did.
if (processingCache[url]) {
return processingCache[url]
}
if (!url || isWebUri(url) === undefined) {
return Promise.reject(
new Error(
`url passed to create-remote-file-node is either missing or not a proper web uri: ${url}`
)
)
}
View on GitHub (pinned to 8b06340921)
Solutions
- Upgrade gatsby-source-wordpress (and Gatsby core) to matching, current versions.
- Restart gatsby develop / gatsby clean to clear stale internal state.
- If forking, ensure cache is forwarded into the createRemoteFileNode call site.
- Confirm pluginOptions and gatsbyApi are correctly populated in the store before media processing runs.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
if (!(typeof cache === 'object' && cache)) { throw new TypeError('Cache not available in the WordPress media step') } Type guard
const isCache = (v) => v && typeof v === 'object' && typeof v.get === 'function'
Try / catch
null
Prevention
- Upgrade gatsby-source-wordpress and run gatsby clean
- Confirm pluginOptions and gatsbyApi are populated in the store
- If forking, forward cache into the media step
When it happens
Trigger: Internal plugin refactor that stopped forwarding cache; running outside a Gatsby lifecycle that provides cache; broken helpers object in the store.
Common situations: Version mismatch between gatsby-source-wordpress and Gatsby core; stale internal state in the plugin store after a hot reload in gatsby develop; forking that dropped cache forwarding.
Related errors
- Neither "cache" or "getCache" was passed. getCache must be f
- Neither "cache" or "getCache" was passed. getCache must be f
- createNodeId must be a function, was ${typeof createNodeId}
- createNode must be a function, was ${typeof createNode}
- You must specify either a cache or a directory
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/21480fb5567471fa.
Report an issue: GitHub.