An asynchronous promise rejected without an attached .catch() or try/catch block.
Occurs when a Promise rejects (e.g. network failure, server error response) and no error handler is attached to catch the error.
Calling `fetch()` or async API routes without wrapping in `try...catch` or chaining `.catch()`, or failing to handle rejected promises in `Promise.all()`.
1async function fetchUserData(userId) {2 const response = await fetch(`/api/users/${userId}`);3 const data = await response.json(); // Throws if 404/500 JSON parse fails!4 return data;5}6 7fetchUserData("invalid-id"); // Unhandled promise rejection!1async function fetchUserData(userId) {2 try {3 const response = await fetch(`/api/users/${userId}`);4 if (!response.ok) {5 throw new Error(`HTTP error! status: ${response.status}`);6 }7 return await response.json();8 } catch (error) {9 console.error("Failed to fetch user:", error.message);10 return null; // Graceful fallback11 }12}13 14fetchUserData("invalid-id");Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
When `fetch` fails or `response.json()` encounters an invalid payload, the promise rejects. Because the caller did not wrap the call in `try/catch`, Node/browser logs an UnhandledPromiseRejection warning/error.