Skip to content

Codex Cloud: spawnSync with piped stdio returns EPERM and breaks Next.js build #50642

Open

Description

@25s6bktvth-cpu

Summary

In Codex Cloud, synchronous Node.js child processes behave unexpectedly when stdio uses pipes.

Direct execution works normally, and stdio: 'inherit' also works. However, spawnSync / execFileSync with piped stdio can return EPERM, and stdout/stderr may be empty.

This causes a Next.js build to fail when Next.js invokes tsc --showConfig and attempts to capture the JSON output.

The build fails with:

Could not parse output from TypeScript's --showConfig.

Environment

  • Codex Cloud
  • OS: Linux
  • Node.js: v24.19.0
  • pnpm: 11.25.0
  • Environment ID: ccarenv_b64_Y2NhcmVudl80ZDUyY2QzZTk0MDg4MTkxODM4ZTIwNjM3ZjFlMmQ2ZQ
  • Reproduced at: 2026-10-03T13:32:09.880Z
  • Reproduced in a newly created Cloud task

Minimal reproduction

const { spawnSync } = require('node:child_process');

const r = spawnSync(
  process.execPath,
  ['-e', 'console.log(123)'],
  {
    encoding: 'utf8',
    stdio: 'pipe'
  }
);

console.log(r);

Observed result:

  • error.code: EPERM
  • error.errno: -1
  • status: 0
  • signal: null
  • stdout: ""
  • stderr: ""

Example error:

spawnSync /opt/codex/runtimes/codex-primary-runtime/dependencies/node/bin/node EPERM

stdio comparison

  • stdio: 'pipe': EPERM reproduced
  • stdio: ['pipe','pipe','pipe']: EPERM reproduced
  • stdio: ['ignore','pipe','pipe']: no EPERM, but stdout remained empty instead of expected output
  • stdio: 'inherit': works normally; output is displayed correctly

/bin/echo comparison

The issue is not limited to spawning Node itself.

const { spawnSync } = require('node:child_process');

const r = spawnSync(
  '/bin/echo',
  ['123'],
  {
    stdio: ['pipe','pipe','pipe'],
    encoding: 'utf8'
  }
);

Observed:

  • error.code: EPERM
  • error.errno: -1
  • status: 0
  • signal: null
  • stdout: "123\n"
  • stderr: ""

So EPERM can occur even when the child process successfully produces output.

Additional environment observations

  • TERM: present
  • CI: absent
  • CODEX_* environment variables are present
  • Values were not exposed

Expected behavior

Node.js synchronous child processes using piped stdio should behave normally and allow the parent process to capture stdout/stderr.

Actual behavior

Piped stdio causes EPERM and/or missing stdout/stderr, while direct execution and inherited stdio work.

This prevents Next.js from reading tsc --showConfig output and causes the build to fail.

Safety / scope

No repository code, Production environment, database, n8n workflow, Preview environment, or Secrets were modified during diagnosis. No workaround has been committed.

Activity

  1. added
    bug
    codex-web
    sandbox
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcodex-websandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions