next.js: "ENOENT: no such file or directory" - next.js crashes, related to image caching?

Run next info (available from version 12.0.8 and up)

root@1d90163fc150:/app# npx --no-install next info
/bin/sh: 1: pnpm: not found

    Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Debian 4.19.171-2 (2021-01-30)
    Binaries:
      Node: 17.4.0
      npm: 8.3.1
      Yarn: 1.22.17
      pnpm: N/A
    Relevant packages:
      next: 12.0.10
      react: 17.0.2
      react-dom: 17.0.2

What version of Next.js are you using?

12.0.10

What version of Node.js are you using?

17.4.0

What browser are you using?

Chrome

What operating system are you using?

Debian

How are you deploying your application?

next build

Describe the Bug

Upgraded my site to next.js 12.0.10 and with the new release started getting errors;

today at 2:27:38 PMready - started server on 0.0.0.0:3000, url: http://localhost:3000
today at 2:27:38 PMinfo  - Loaded env from /app/.env.production
today at 2:27:38 PMinfo  - Loaded env from /app/.env
today at 2:27:39 PMwarn  - SWC minify beta enabled. https://nextjs.org/docs/messages/swc-minify-enabled
today at 2:37:32 PMError: ENOENT: no such file or directory, open '/app/.next/cache/images/iLU6LIXA6TCl8SepFjJ5LNbyzLiOqZ7U49T1Ftm+jW4=/0.1643714865404.blKDVxGlp5+pf7TBeZBnD7i-BF2A5hQCHH0jGL--cVU=.avif'

and then next server dies and restarts

Expected Behavior

shouldn’t be crashing.

To Reproduce

any code with avif + image caching support i guess

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 31
  • Comments: 31 (10 by maintainers)

Commits related to this issue

Most upvoted comments

This is fixed on canary, thanks!

You can try it out today with npm i next@canary or yarn add next@canary.

I also discovered that serving stale images wasn’t any faster because revalidation wasn’t happening in the background, it was blocking. So I created PR #33930 with the another fix. (Update: closed in favor of #34075)

Update: This has been released in Next.js 12.1.0

Wow thanks. This is one of those rare occasions that I search for an error, only to find it wasn’t my mistake and fixed in the last few days 😍

Sending appreciation for next@canary and nextjs team!

downgraded to 12.0.9 now and it seems all good, i think this may be the offfending commit: https://github.com/vercel/next.js/pull/33719

@styfle hey. Here’s the repo that crashes: https://github.com/b-novikov-ipersonality/nextjs-cache-crash

  1. yarn build
  2. yarn start
  3. Open http://localhost:3000
  4. Refresh page
  5. Experience crash.

I have this error as well, @ijjk out of curiosity, when is 12.0.11 planned to be released? Knowing would help me in how I would like to work around this for now.

No more errors, thanks alot for the quick fix!

@yayza the above PR is now landed in v12.0.11-canary.13, please update and give it a try!

@yayza Ah I see, thanks for sharing that additional info, looks like this is an issue with writing to cache specifically with the rmdir method used to clean the dir. I opened a PR with a fix for this here https://github.com/vercel/next.js/pull/34210

@joggienl they just released 12.1.0 today