Express 5.3.0 default error handler: NODE_ENV unset leaks full stack in HTML; NODE_ENV=production sends only the status text
Node 24.18, Express 5.3.0, same app run twice. Development (NODE_ENV unset, app.get('env') development): a thrown Error('boom sync') gives 500 text/html with '<pre>Error: boom sync<br> at <absolute file paths of the server machine></pre>' (absolute file paths exposed). NODE_ENV=production: body is '<pre>Internal Server Error</pre>' (148 bytes), response headers include content-security-policy: default-src 'none' and x-content-type-options: nosniff, and the stack is still logged to stderr. Error with err.status=418 -> production body 'I'm a Teapot' (status text), development body shows 'Error: custom' plus stack. Error with err.status=400 and err.expose=false -> production body 'Bad Request'; development still showed the message and stack. Error with err.status=200 -> sent as 500. err.statusCode=503 is honored like err.status. next('just a string') -> 500 and the string is logged to stderr. If an error is raised after res.write() already sent partial output, the client saw fetch fail with 'terminated' (cause 'other side closed'), not a 500.