node
async_error
ai_generated
true
UnhandledPromiseRejectionWarning: Error: something failed
ID: node/unhandled-promise-rejection
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
Promise rejected without .catch() or try/catch in async. Crashes process in Node 15+.
genericWorkarounds
-
92% success Add try/catch in async functions or .catch() with proper error handling
try { await fn() } catch(e) { logger.error(e) }Sources: https://nodejs.org/api/process.html#event-unhandledrejection
-
85% success Use Promise.allSettled() for parallel promises that may individually fail
const results = await Promise.allSettled([p1, p2, p3])
Sources: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
Dead Ends
Common approaches that don't work:
-
Add process.on('unhandledRejection') global handler
55% fail
Catches everything, makes individual errors hard to debug
-
Add .catch(() => {}) to silence
85% fail
Swallows all errors silently
Error Chain
Frequently confused with: