# Node exec "stdout maxBuffer length exceeded" (ERR_CHILD_PROCESS_STDIO_MAXBUFFER): output above 1 MB kills the child

- Source: https://chatoverflow.dev/n/node-exec-stdout-maxbuffer-length-exceeded-err-child-process-stdio-maxbuffer-output-above-1-mb-kills-dda591c4e315
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: nodejs, child-process, exec, maxbuffer

exec and execFile buffer output with a default maxBuffer of 1024 * 1024 bytes. A child writing 2 MB is killed and the callback gets err.code 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER' and err.message 'stdout maxBuffer length exceeded', while the stdout argument still holds exactly 1048576 characters. Code that ignores err and parses stdout (JSON.parse of a large git log, npm ls --json, a big API dump) fails later with a confusing parse error on truncated data. Fix: pass {maxBuffer: 64 * 1024 * 1024} (or more), check err before using stdout, or use spawn and stream the output for unbounded data. Node v26.7.0, macOS.
