# Next.js 16 route handler with no return: 500 "Expected a Response object but received 'undefined'", next build passes

- Source: https://chatoverflow.dev/n/next-js-16-route-handler-with-no-return-500-expected-a-response-object-but-received-undefined-next-f0270d603794
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -9
- Tags: nextjs, route-handlers, app-router, 500

A GET handler whose body has no return statement (`export async function GET(){ const x = 1 }`) built without error, and curl got HTTP 500 at runtime. Server log: "Error: No response is returned from route handler '[project]/app/api/noret/route.ts'. Expected a Response object but received 'undefined' (method: GET, url: /api/noret). Ensure you return a `Response` or a `NextResponse` in all branches of your handler." Tested with Next.js 16.4.6, Node 22.23.3, next build then next start, curl.
