Skip to content

npm install exits 0 and leaves broken Codex CLI when platform tarball download fails #41283

Description

@Chi-Shan0707

Summary

npm install -g @openai/codex can exit successfully after the required platform tarball fails to download, leaving a Codex CLI installation that cannot start.

In this case, the Linux x64 platform package was already published and resolvable. The npm debug log records ECONNRESET while fetching its tarball. Because the platform package is an aliased optionalDependency, npm dropped it from the tree, returned exit code 0, and printed a successful-looking install summary. The installed JavaScript launcher then failed immediately with Missing optional dependency @openai/codex-linux-x64.

Environment

  • Codex CLI: 0.150.1
  • Node.js: v24.13.0
  • npm: 11.7.0
  • OS: Ubuntu 24.04.1 LTS under WSL2
  • Kernel: 6.6.87.2-microsoft-standard-WSL2
  • Architecture: Linux x64
  • Install method: global npm install under nvm
  • npm registry: https://registry.npmjs.org/
  • No npm proxy, custom registry, or omit=optional configuration

Observed behavior

Running:

$ npm install -g @openai/codex
added 1 package, and changed 1 package in 36s

$ codex --version
Error: Missing optional dependency @openai/codex-linux-x64. Reinstall Codex: npm install -g @openai/codex@latest

Relevant excerpts from the npm debug logs across retries:

http fetch GET https://registry.npmjs.org/@openai/codex/-/codex-0.150.1-linux-x64.tgz attempt 1 failed with ECONNRESET

verbose reify failed optional dependency <home>/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64
silly reify mark deleted [
  '<home>/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64'
]
verbose exit 0
info ok

Several reinstalls ended this way: the wrapper was installed, the platform package was absent, and npm still exited 0.

A later retry using the same Node, npm, OS, configuration, Codex version, and registry succeeded:

http fetch GET 200 https://registry.npmjs.org/@openai/codex/-/codex-0.150.1-linux-x64.tgz 31294ms (cache miss)
silly ADD node_modules/@openai/codex/node_modules/@openai/codex-linux-x64
verbose exit 0
info ok

After that download completed, both the launcher and native binary reported codex-cli 0.150.1. The cached 129,212,827-byte tarball's SHA-512 also matched the registry integrity value.

This was not a platform-package publication race

Registry publish times from npm view @openai/codex time --json:

0.150.1           2026-08-27T02:01:46.851Z
0.150.1-linux-x64 2026-08-27T02:07:53.949Z

The failed installs occurred around 2026-08-27T14:41Z through 15:01Z, more than twelve hours after the Linux package was published. The package metadata resolved correctly; its large tarball fetch failed in transit.

This distinguishes the incident from openai/codex-action#158, where installation began before the platform artifact was available.

Expected behavior

An installation must not report success if the executable required for the current platform was not installed. At minimum, one of these should happen:

  1. The npm install exits nonzero when the current platform package cannot be fetched or extracted.
  2. A post-install check verifies that the current platform executable exists and is runnable.
  3. The installer retries or explicitly installs the selected platform package as a required dependency.
  4. The launcher error explains that npm may have silently skipped a failed optional-dependency download and provides a deterministic repair command.

--include=optional alone does not address this case: the dependency is considered for installation, but a fetch failure can still be suppressed because it remains optional.

Related issues and packaging change

The transport reset itself may be transient and outside Codex's control. The actionable Codex issue is that a transient fetch failure is converted into a successful but unusable installation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingconnectivityIssues involving networking or endpoint connectivity problems (disconnections)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions