turbopack: report the cause when saving the filesystem cache fails (#99823)
## What
Builds with the Turbopack filesystem cache didn't give useful output
when the cache couldn't be written during shutdown, for example because
of a read-only directory or a full disk. The build succeeded, but it
printed a bare `Shutting down failed: <message>` which was not useful
Before:
```
Persisting failed during shutdown: Unable to write SST file 00000020.sst
Caused by:
: Permission denied (os error 13)te/var/folders/p6/ytr7tcts5ndf72xw136ky30m0000gn/T/next-install-6cb7b5bc6e3b95a18ae07aa856827db93efc662fe73934ecebae8de778735e0c/.next/cache/turbopack/v16.5.0-canary.2-2c48f075ef/00000020.sst`
Shutting down failed: A previous write operation failed with an unrecoverable error; no further writes are possible
```
Now:
```
WARNING: Saving the filesystem cache failed:
Unable to write SST file 00000020.sst: failed to create file `/Users/lukesandberg/projects/next_2/next.js/test/tmp/next-test-1791392696220-115/.next/cache/turbopack/unversioned/00000020.sst`: Permission denied (os error 13)
```
The "Shutting down failed" error is gone and the filesystem cache error
is slightly improved.
Also:
- **Compaction is skipped once a write has already failed.** That avoids
a second, redundant failure.
- **Database shutdown can't fail anymore.** Compaction errors during
shutdown are logged as warnings.
---------
Co-authored-by:
vercel-gh-bot-5[bot] <312521305+vercel-gh-bot-5[bot]@users.noreply.github.com>
Showing
This diff is collapsed.
Please
register
or
sign in
to comment