Skip to content

Crash when ~/.pyenv directory doesn't exist: ENOENT in sandbox setup #45

Description

@wydyydlhb1990

open-codex crashes with ENOENT: no such file or directory when the ~/.pyenv directory
doesn't exist on the system.

Environment

  • open-codex version: 0.1.31
  • Node.js: v22.21.1
  • OS: macOS (arm64)

Error

Error: ENOENT: no such file or directory, lstat '/Users/username/.pyenv'
at realpathSync (node:fs:2786:29)
at file:///.../open-codex/dist/cli.js:410:3516
at Array.map ()
at Yae (file:///.../open-codex/dist/cli.js:410:3425)

Root Cause

In cli.js, the YRe() function returns a hardcoded list of directories including
~/.pyenv:

function YRe(){return[Ef,`${process.env.HOME}/.pyenv`]}

These paths are then passed to realpathSync() without checking if they exist:

param:`-DWRITABLE_ROOT_${E}=${HRe(A)}`  // HRe = realpathSync

This crashes if .pyenv is not installed on the system.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions