Error code

Node.js ERR_STREAM_WRITE_AFTER_END

NODE.JSERR_STREAM_WRITE_AFTER_END
Runtime Error Code· An error code from a programming runtime or package manager, like Node.js or npm.

What it means

Data was written to a writable stream after it had been ended.

How to fix it

  1. Ensure end() is only called once all data has been written.
  2. Use the finish event to know when it is safe to stop writing.
  3. Check for race conditions in async write loops.

Not affiliated with Node.js. Answer summarized from the manufacturer's manual linked above; consult that source for the authoritative procedure.