openai/codex · error · Error

Child process has no stdin

Error message

Child process has no stdin

What it means

After spawning the Codex exec child process, child.stdin is falsy — the spawn produced no stdin pipe (already consumed or spawn misconfiguration). The child is killed and the error raised because request input cannot be delivered.

Solutions

  1. Spawn the child process with piped stdin so input can be written to it.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at sdk/typescript/src/exec.ts:206 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/7146391c01a7c7e2. Report an issue: GitHub.

Appendix: source

Thrown at sdk/typescript/src/exec.ts:206

    }
    if (args.apiKey) {
      env.CODEX_API_KEY = args.apiKey;
    }
    if (this.pathDirs.length > 0) {
      prependPathDirs(env, this.pathDirs);
    }

    const child = spawn(this.executablePath, commandArgs, {
      env,
      signal: args.signal,
    });

    let spawnError: unknown | null = null;
    child.once("error", (err) => (spawnError = err));

    if (!child.stdin) {
      child.kill();
      throw new Error("Child process has no stdin");
    }
    child.stdin.write(args.input);
    child.stdin.end();

    if (!child.stdout) {
      child.kill();
      throw new Error("Child process has no stdout");
    }
    const stderrChunks: Buffer[] = [];

    if (child.stderr) {
      child.stderr.on("data", (data) => {
        stderrChunks.push(data);
      });
    }

    const exitPromise = new Promise<{ code: number | null; signal: NodeJS.Signals | null }>(
      (resolve) => {

View on GitHub (pinned to 339751715c)