mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
When a custom `"use cache"` cache handler's `get` method throws, the
error was logged up to four times for a single request: once as the
intended rendering error (`⨯ Error: ... { digest }`), and up to three
more times through the various `unhandledRejection` handlers (the
runtime's plain `console.error` in `process-error-handlers.ts`, the
router server's `Log.error`, and the dev overlay's log forwarding).
All the redundant logs stemmed from the same root cause:
`ResolvableSharedCacheResult` stores its deferred promise in the dedup
maps (`pendingCacheInvocations` / `crossRequestPendingCacheInvocations`)
so concurrent invocations can join the leader. That promise has no
consumer unless another invocation actually joins it, so when the
leader's cache access failed, the rejected promise was left behind
without a rejection handler, and Node.js reported it as an unhandled
rejection that fanned out to every installed handler.