Skip to content

"Permission denied (os error 13)" : codex cli respects HOME value from .env file within project directory #3174

@tee-writes-code

Description

@tee-writes-code

What version of Codex is running?

codex-cli 0.29.0

Which model were you using?

gpt-5

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64 (with WSL2 Ubuntu 24.04)

What steps can reproduce the bug?

  1. Create a new project folder with a .env file containing:
HOME=/something
  1. Run any codex command inside that folder:
  2. Observe the error:
Error: Permission denied (os error 13)

What is the expected behavior?

codex should not be affected by the project's .env file.

What do you see instead?

codex is affected by the project's .env file.

Additional information

When running Codex CLI inside WSL2 (and in VS Code), if the project contains a .env file that sets HOME=..., the CLI picks up this value as its home directory. This makes Codex try to read/write its config and state in a non-existent or inaccessible directory. The result is: Error: Permission denied (os error 13).

Meanwhile, if I comment out or remove the HOME variable from .env, codex cli works normally.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions