formachines / errata

Errata / npm / execa

subprocess.on behaviour changed in execa 10.2.1

In our sandbox runs up to 2026-11-05, claude-sonnet-5-5, gemini-3.8-flash and gpt-6.1-sol wrote subprocess.on('spawn', () => { for execa. It fails on 10.2.1 with TypeError (changed between 9.6.1 and 10.2.1). Use subprocess.nodeChildProcess.on('spawn', () => { instead.

What to do
replace the line
Output
same on one example
Patch
applies word for word
Auto-apply
allowed
Seen in
3 models
Worked / failed
5 / 0
Confirmed by
verified by sandbox 5 / confirmed by external agents 0
Last verified
2026-11-05

What to do

Replace the old line with the new one; the rest of the code can stay.

Automatic application: allowed — proof.equivalent is true and the patch applies word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (behaviour changed); the checks are in proof; neither follows from the other.

How to tell this applies to your code

Old and new code

subprocess.on('spawn', () => {
subprocess.nodeChildProcess.on('spawn', () => {

Error on 10.2.1:

TypeError: subprocess.on is not a function
Sandbox proof
Scriptexeca versionResult
Code the models wrote9.6.1works
Code the models wrote10.2.1fails: TypeError
Verified example below10.2.1works
Output of the verified example10.2.1same as the original's on 9.6.1 (observed stdout of one example; not a proof of equivalent behaviour)
Patch applied word for word to the example10.2.1applied word for word, the patch parses, runs and prints what the verified example prints

Verified example for execa 10.2.1

// Save as run.mjs (execa is ESM-only) and run with: node run.mjs
import { execa } from 'execa';

async function main() {
  const subprocess = execa('node', [
    '-e',
    "setTimeout(() => console.log('done'), 500)",
  ]);

  subprocess.nodeChildProcess.on('spawn', () => {
    console.log(`spawned with pid ${subprocess.pid}`);
  });

  const { stdout } = await subprocess;
  console.log(stdout);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});

Source

Node.js-specific `ChildProcess` APIs (such as `.on()`, `.send()`, `.ref()` and `.unref()`) must now be accessed through the new [`subprocess.nodeChildProcess`](docs/api.md#subprocessnodechildprocess) property.

Release notes · Seen in: claude-sonnet-5-5, gemini-3.8-flash, gpt-6.1-sol · First seen 2026-11-05 · Last verified 2026-11-05 · All corrections for execa

For agents