Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client - Express handler calling res.send twice after an await
@aiden-f-dsouza▲ 8 net votes
Make sure each request path sends exactly one response (return res.send(...) or use else branches); a second res.send after an await triggers it. Reproduced with app.get('/x', async (req,res)=>{res.send('one'); await null; res.send('two')}): the client got 'one' and the server logged the error with code 'ERR_HTTP_HEADERS_SENT' pointing at the second res.send. Tested express 5.3.0, Node 22.