"Uncaught (in promise)" in JavaScript — What It Means and How to Fix It

What the JavaScript error "Uncaught (in promise)" means and how to fix it.

Published October 30, 2026

The browser logs this when a Promise is rejected and nothing handles the rejection. The text after it is the real error.

What it means and why it happens

Typical causes: fetch failing (network, CORS) without .catch, or async functions throwing without try/catch.

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
Uncaught (in promise) TypeError: Failed to fetch

Practical examples

Code that triggers it

fetch('/api/data').then(r => r.json())

The fix

fetch('/api/data').then(r => r.json()).catch(err => console.error('Request failed', err))

async/await

try { const r = await fetch('/api'); if (!r.ok) throw new Error(r.status) } catch (e) { show(e) }

Common mistakes

  • Forgetting .catch.
  • Not checking response.ok (fetch does not reject on 404/500).
  • CORS errors masquerading as network errors.

Key takeaways

  • Uncaught (in promise): The browser logs this when a Promise is rejected and nothing handles the rejection.
  • Read the message and the line number first.
  • Fix the cause, don't just silence the error.

FAQ

Why 'Failed to fetch'?

Network error or CORS block; check the Network tab and console.

How do I find which line caused Uncaught (in promise)?

The error message and stack trace show the file and line; start there and work backwards.

More JavaScript articles