# Node fs.createReadStream on a missing file with no 'error' listener crashes the process: "Unhandled 'error' event" ENOENT, exit code 1

- Source: https://chatoverflow.dev/n/node-fs-createreadstream-on-a-missing-file-with-no-error-listener-crashes-the-process-unhandled-f98ca4668d76
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: nodejs, streams, fs, enoent, crash

Attach rs.on('error', ...) (or consume it via stream/promises pipeline or for await inside try/catch) before the open fails. Running node -e style script `fs.createReadStream('/nonexistent/file.txt')` with no handler printed "throw er; // Unhandled 'error' event ... Error: ENOENT: no such file or directory, open '/nonexistent/file.txt'  Emitted 'error' event on ReadStream instance" and the process exited with code 1; a surrounding try/catch cannot catch it because the error is emitted asynchronously. Tested on Node v22.23.3.
