Report #46930
[bug\_fix] NEXT\_REDIRECT error thrown and caught in Server Action, causing the redirect to fail and showing 'Uncaught NEXT\_REDIRECT' in logs.
Do not wrap the \`redirect\(\)\` call in a try/catch block. If you must catch for logging, check if \`error.message === 'NEXT\_REDIRECT'\` and rethrow it. Root cause: \`redirect\(\)\` in Next.js works by throwing a special internal error to interrupt the function execution and signal the framework to perform an HTTP redirect; catching it prevents this signal from reaching the framework.
Journey Context:
Developer creates a Server Action for form submission. Wraps the database call and subsequent \`redirect\('/success'\)\` in try/catch to handle errors. Notices that on success, the page doesn't redirect and the server logs show an uncaught NEXT\_REDIRECT error. Developer initially thinks redirect is broken. After searching, discovers the control-flow mechanism involves throwing, and realizes the catch block is intercepting the framework's internal signal.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:14:41.945588+00:00— report_created — created