can1357/oh-my-pi · error
Full stderr capture must be requested when spawning the proc
Error message
Full stderr capture must be requested when spawning the process (pass stderr: "full")
What it means
ExecResult.wait({ stderr: "full" }) requires that full stderr buffering was requested at spawn time. If the process was spawned without stderr capture, the data is gone by the time wait() runs, so the library throws this mismatch error instead of returning empty output.
Source
Thrown at packages/utils/src/ptree.ts:499
async json(): Promise<unknown> {
return JSON.parse(new TextDecoder().decode(await this.#readOutputBytes()));
}
async arrayBuffer(): Promise<ArrayBuffer> {
return (await this.#readOutputBytes()).buffer as ArrayBuffer;
}
async bytes(): Promise<Uint8Array> {
return this.#readOutputBytes();
}
// ── Wait ─────────────────────────────────────────────────────────────
async wait(opts?: WaitOptions): Promise<ExecResult> {
const { allowNonZero = false, allowAbort = false, stderr: stderrMode = "buffer" } = opts ?? {};
const stderrChunks = this.#stderrChunks;
if (stderrMode === "full" && !stderrChunks) {
throw new Error('Full stderr capture must be requested when spawning the process (pass stderr: "full")');
}
const stdoutP = this.#readStream(this.proc.stdout);
const stderrP =
stderrMode === "full" && stderrChunks
? this.#stderrDone.then(() => new TextDecoder().decode(Buffer.concat(stderrChunks)))
: this.#stderrDone.then(() => this.#stderrTail);
const [stdout, stderr] = await Promise.all([stdoutP, stderrP]);
let exitError: Exception | undefined;
try {
await this.#exited;
} catch (err) {
if (err instanceof Exception) exitError = err;
else throw err;
}
this.#clearTimeout();View on GitHub (pinned to 9690622007)
Solutions
- Pass `stderr: "full"` in the spawn options when creating the process.
- Use `stderr: "buffer"` (default) in wait() if full capture is not needed.
- Check which spawn wrapper created the process and align its stderr option with the wait call.
Example fix
// before
const proc = spawn(cmd, { stdout: "pipe", stderr: "pipe" });
await proc.wait({ stderr: "full" });
// after
const proc = spawn(cmd, { stdout: "pipe", stderr: "full" });
await proc.wait({ stderr: "full" }); Defensive patterns
Strategy: validation
Validate before calling
if (wantsFullStderr) {
// at spawn time
spawn(cmd, { stdout: 'pipe', stderr: 'full' });
} Try / catch
try {
const res = await proc.wait({ stderr: 'full' });
} catch (err) {
if (String(err.message).includes('stderr: \"full\"')) {
throw new Error('spawn the process with stderr: "full" to use this wait mode');
} else throw err;
} Prevention
- Keep spawn options and wait options in the same helper so they can't drift.
- Grep for wait({ stderr: 'full' }) call sites whenever changing spawn defaults.
- Prefer the default 'buffer' mode unless full stderr is genuinely required.
When it happens
Trigger: Calling `await proc.wait({ stderr: "full" })` (or helpers defaulting to stderrMode "full") on a process spawned without `stderr: "full"` — the internal #stderrChunks buffer is undefined.
Common situations: Copy-pasting wait options onto an existing spawn helper; a helper upgraded to return full stderr without updating the spawn call; defaults changing between library versions.
Related errors
- ${argv[0]} exited with code ${exitCode}: ${stderr.trim().sli
- Process exited with code ${exitCode}: ${stderr}
- No messages to continue from
- Cannot continue from message role: assistant
- Gemini Files API cannot delete a handle from another provide
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/a9b702baab5b7157.
Report an issue: GitHub.