Build Failed: Plugin "@netlify/plugin-gatsby" internal error (imageCdnEncryptionConfig.json not found)

PLEASE help us help you by writing a good post!

Project Name: movinwayt
Issue: My build is failing because of this Plugin “@netlify/plugin-gatsby” internal error. (see stack trace below)

╭────────────────────────────────────────────────────────────────────╮
7:28:37 PM: │ │
7:28:37 PM: │ (SSG) Generated at build time │
7:28:37 PM: │ D (DSG) Deferred static generation - page generated at runtime │
7:28:37 PM: │ ∞ (SSR) Server-side renders at runtime (uses getServerData) │
7:28:37 PM: │ λ (Function) Gatsby function │
7:28:37 PM: │ │
7:28:37 PM: ╰────────────────────────────────────────────────────────────────────╯
7:28:37 PM: info Done building in 79.188364986 sec
7:28:37 PM: NX Successfully ran target build for project apps/mw-web
7:28:38 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 4 (Search results for '"non-zero exit code: 4"' - Netlify Support Forums)
7:28:38 PM: ┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
7:28:38 PM: │ Tasks run for command: nx run mw-web:build │
7:28:38 PM: ├──────────────────────────────────────────────────────────────────────────────────────────────────┤
7:28:38 PM: ├────────┬─────────────────────────────────────────────────────────┬──────────┬────────────────────┤
7:28:38 PM: │ Status │ Task │ Duration │ Cache Status │
7:28:38 PM: ├────────┼─────────────────────────────────────────────────────────┼──────────┼────────────────────┤
7:28:38 PM: │ :check_mark: │ apps/mw-web:build │ 1m 19s │ Cache Miss │
7:28:38 PM: └────────┴─────────────────────────────────────────────────────────┴──────────┴────────────────────┘
7:28:38 PM: ┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
7:28:38 PM: │ Nx Cloud Task Runner Report │
7:28:38 PM: ├──────────────────────────────────────────────────────────────────────────────────────────────────┤
7:28:38 PM: ├────────┬────────────────────────────────────────┬────────┬───────────────────────────────────────┤
7:28:38 PM: │ 1 │ Successful Tasks │ 100% │ Success Percentage │
7:28:38 PM: │ 0 │ Failed Tasks │ 0% │ Failure Percentage │
7:28:38 PM: ├────────┼────────────────────────────────────────┼────────┼───────────────────────────────────────┤
7:28:38 PM: │ 0 │ Cached Tasks │ 0% │ Cache Hit Percentage │
7:28:38 PM: │ 1 │ Total Executed Tasks │ 1m 19s │ Run Duration │
7:28:38 PM: ├────────┴────────────────────────────────────────┴────────┴───────────────────────────────────────┤
7:28:38 PM: │ See more details: Run details
7:28:38 PM: └──────────────────────────────────────────────────────────────────────────────────────────────────┘
7:28:38 PM: ​
7:28:38 PM: (build.command completed in 1m 20.4s)
7:28:38 PM: ​
7:28:38 PM: Plugin “@netlify/plugin-gatsby” internal error
7:28:38 PM: ────────────────────────────────────────────────────────────────
7:28:38 PM: ​
7:28:38 PM: Error message
7:28:38 PM: Error: ENOENT: no such file or directory, open ‘/opt/build/repo/dist/apps/.cache/imageCdnEncryptionConfig.json’
7:28:38 PM: ​
7:28:38 PM: Plugin details
7:28:38 PM: Package: @netlify/plugin-gatsby
7:28:38 PM: Version: 3.8.3
7:28:38 PM: Repository: git+https://github.com/netlify/netlify-plugin-gatsby.git
7:28:38 PM: npm link: @netlify/plugin-gatsby - npm
7:28:38 PM: Report issues: GitHub · Where software is built
7:28:38 PM: ​
7:28:38 PM: Error location
7:28:38 PM: In “onBuild” event in “@netlify/plugin-gatsby” from Netlify app
7:28:38 PM: ​
7:28:38 PM: Error properties
7:28:38 PM: {
7:28:38 PM: errno: -2,
7:28:38 PM: code: ‘ENOENT’,
7:28:38 PM: syscall: ‘open’,
7:28:38 PM: path: ‘/opt/build/repo/dist/apps/.cache/imageCdnEncryptionConfig.json’
7:28:38 PM: }
7:28:38 PM: ​
7:28:38 PM: Resolved config
7:28:38 PM: build:
7:28:38 PM: command: nx run mw-web:build
7:28:38 PM: commandOrigin: ui
7:28:38 PM: environment:
7:28:38 PM: - GATSBY_DISQUS_NAME
7:28:38 PM: - GOOGLE_ANALYTICS_TRACKING_ID
7:28:38 PM: - INSTAGRAM_ACCESS_TOKE
7:28:38 PM: - INSTAGRAM_ID
7:28:38 PM: - INSTAGRAM_USER_NAME
7:28:38 PM: - INSTAGRAM_USER_NAME_ID
7:28:38 PM: - MAILCHIMP_ENDPOINT
7:28:38 PM: - NETLIFY_SKIP_GATSBY_FUNCTIONS
7:28:38 PM: publish: /opt/build/repo/dist/apps/mw-web
7:28:38 PM: publishOrigin: ui
7:28:38 PM: plugins:
7:28:38 PM: - inputs: {}
7:28:38 PM: origin: ui
7:28:38 PM: package: ‘@netlify/plugin-gatsby’
7:28:38 PM: Build failed due to an internal system error: Build script returned non-zero exit code: 4
7:28:38 PM: Failing build: Failed to build site
7:28:38 PM: Finished processing build request in 3m7.873s

Hey there! Can you try removing Gatsby as the runtime here? We’ve seen this can potentially cause issues (and the runtime should get installed automatically during the build). Let me know if this helps!