···121121vitest --pool=forks
122122```
123123:::
124124+125125+## Unhandled Promise Rejection
126126+127127+This error happens when a Promise rejects but no `.catch()` handler or `await` is attached to it before the microtask queue flushes. This behavior comes from JavaScript itself and is not specific to Vitest. Learn more in the [Node.js documentation](https://nodejs.org/api/process.html#event-unhandledrejection).
128128+129129+A common cause is calling an async function without `await`ing it:
130130+131131+```ts
132132+async function fetchUser(id) {
133133+ const res = await fetch(`/api/users/${id}`)
134134+ if (!res.ok) {
135135+ throw new Error(`User ${id} not found`) // [!code highlight]
136136+ }
137137+ return res.json()
138138+}
139139+140140+test('fetches user', async () => {
141141+ fetchUser(123) // [!code error]
142142+})
143143+```
144144+145145+Because `fetchUser()` is not `await`ed, its rejection has no handler and Vitest reports:
146146+147147+```
148148+Unhandled Rejection: Error: User 123 not found
149149+```
150150+151151+### Fix
152152+153153+`await` the promise so Vitest can catch the error:
154154+155155+```ts
156156+test('fetches user', async () => {
157157+ await fetchUser(123) // [!code ++]
158158+})
159159+```
160160+161161+If you expect the call to throw, use [`expect().rejects`](/api/expect#rejects):
162162+163163+```ts
164164+test('rejects for missing user', async () => {
165165+ await expect(fetchUser(123)).rejects.toThrow('User 123 not found')
166166+})
167167+```