Error UNHANDLED REJECTION ENOENT: no such file or directory, open '/opt/build/repo/.cache/json/_carbon-filters_.json'

I’ve deployed this a few times with no issue. However deploying some recent content changes to the site, the site is now blank and won’t deploy. Following error message I’m getting:

error UNHANDLED REJECTION ENOENT: no such file or directory, open '/opt/build/repo/.cache/json/_carbon-filters_.json'

The build runs successfully on my local machine but this error is thrown when deployed up to Netlify. Any help to solve this would be greatly, greatly appreciated.

Link to site here.

Link to git repo here.

Build settings:

Full log below:

8:57:48 AM: $ gatsby build
8:57:51 AM: success open and validate gatsby-configs - 0.049s
8:57:52 AM: success load plugins - 0.261s
8:57:52 AM: success onPreInit - 0.033s
8:57:52 AM: success delete html and css files from previous builds - 0.005s
8:57:52 AM: success initialize cache - 0.004s
8:57:52 AM: success copy gatsby files - 0.040s
8:57:52 AM: success onPreBootstrap - 0.014s
8:57:52 AM: success createSchemaCustomization - 0.001s
8:57:52 AM: success Checking for changed pages - 0.000s
8:57:52 AM: success source and transform nodes - 0.064s
8:57:52 AM: success building schema - 0.222s
8:57:52 AM: info Total nodes: 36, SitePage nodes: 1 (use --verbose for breakdown)
8:57:52 AM: success createPages - 0.001s
8:57:52 AM: success Checking for changed pages - 0.000s
8:57:52 AM: success createPagesStatefully - 0.102s
8:57:52 AM: success Cleaning up stale page-data - 0.002s
8:57:52 AM: success update schema - 0.034s
8:57:52 AM: success onPreExtractQueries - 0.000s
8:57:53 AM: success extract queries from components - 0.232s
8:57:53 AM: success write out redirect data - 0.001s
8:57:53 AM: success onPostBootstrap - 0.000s
8:57:53 AM: info bootstrap finished - 4.085s
8:57:53 AM: success run page queries - 0.009s - 1/1 113.38/s
8:57:53 AM: success write out requires - 0.004s
8:58:14 AM: success Building production JavaScript and CSS bundles - 21.546s
8:58:14 AM: success Rewriting compilation hashes - 0.001s
8:58:14 AM: error UNHANDLED REJECTION ENOENT: no such file or directory, open ‘/opt/build/repo/.cache/json/carbon-filters.json’
8:58:14 AM:
8:58:14 AM:
8:58:14 AM: Error: ENOENT: no such file or directory, open ‘/opt/build/repo/.cache/json/c arbon-filters.json’
8:58:14 AM:
8:58:15 AM: ​
8:58:15 AM: ────────────────────────────────────────────────────────────────
8:58:15 AM: “build.command” failed
8:58:15 AM: ────────────────────────────────────────────────────────────────
8:58:15 AM: ​
8:58:15 AM: Error message
8:58:15 AM: Command failed with exit code 1: gatsby build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
8:58:15 AM: ​
8:58:15 AM: Error location
8:58:15 AM: In Build command from Netlify app:
8:58:15 AM: gatsby build
8:58:15 AM: ​
8:58:15 AM: Resolved config
8:58:15 AM: build:
8:58:15 AM: command: gatsby build
8:58:15 AM: commandOrigin: ui
8:58:15 AM: publish: /opt/build/repo/public
8:58:15 AM: publishOrigin: ui
8:58:15 AM: plugins:
8:58:15 AM: - inputs: {}
8:58:15 AM: origin: ui
8:58:15 AM: package: ‘@netlify/plugin-gatsby’
8:58:15 AM: Caching artifacts
8:58:15 AM: Started saving node modules
8:58:15 AM: Finished saving node modules
8:58:15 AM: Started saving build plugins
8:58:15 AM: Finished saving build plugins
8:58:15 AM: Started saving yarn cache
8:58:23 AM: Finished saving yarn cache
8:58:23 AM: Started saving pip cache
8:58:23 AM: Finished saving pip cache
8:58:23 AM: Started saving emacs cask dependencies
8:58:23 AM: Finished saving emacs cask dependencies
8:58:23 AM: Started saving maven dependencies
8:58:23 AM: Finished saving maven dependencies
8:58:23 AM: Started saving boot dependencies
8:58:23 AM: Creating deploy upload records
8:58:23 AM: Finished saving boot dependencies
8:58:23 AM: Started saving rust rustup cache
8:58:23 AM: Finished saving rust rustup cache
8:58:23 AM: Started saving go dependencies
8:58:23 AM: Finished saving go dependencies
8:58:24 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:58:23 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:58:24 AM: Failing build: Failed to build site
8:58:24 AM: Finished processing build request in 1m13.889900661s

Hey @glaserweb,

What happens if you change your build command to gatsby clean && gatsby build?

It worked! Thank you so much.