UnhandledPromiseRejectionWarning in Node.js — What It Means and How to Fix It
What the Node.js/npm error UnhandledPromiseRejectionWarning means and how to resolve it.
Published October 25, 2026
This means a Promise was rejected and no .catch() or try/catch handled it. In modern Node it crashes the process.
What it means and why it happens
Typical causes: missing await in try/catch, forgetting .catch(), or errors in async event handlers.
Read the full message: it names the file and line where the problem was detected, which is the best place to start.
What you see
run the code
UnhandledPromiseRejectionWarning: Unhandled promise rejection
Practical examples
Code that triggers it
async function run() { throw new Error('boom') }
run()The fix
run().catch(err => { console.error(err); process.exitCode = 1 })Global safety net
process.on('unhandledRejection', (err) => { console.error(err); process.exit(1) })Common mistakes
- Calling async functions without awaiting or catching.
- try/catch around code that is not awaited.
- Ignoring rejections in forEach callbacks.
Key takeaways
- UnhandledPromiseRejectionWarning: This means a Promise was rejected and no .catch() or try/catch handled it.
- Read the message and the line number first.
- Fix the cause, don't just silence the error.
FAQ
Does Node still just warn?
Since Node 15 unhandled rejections crash the process by default.
How do I find which line caused UnhandledPromiseRejectionWarning?
The error message and stack trace show the file and line; start there and work backwards.