openai/codex · error · FileNotFoundError

Codex binary not found at {codex_bin}. Set CodexConfig.codex

Error message

Codex binary not found at {codex_bin}. Set CodexConfig.codex_bin to a valid binary path.

What it means

Error "Codex binary not found at {codex_bin}. Set CodexConfig.codex_bin to a valid binary path." thrown in openai/codex.

Source

Thrown at sdk/python/src/openai_codex/client.py:180

@dataclass(frozen=True)
class CodexBinResolverOps:
    installed_codex_path: Callable[[], Path]
    path_exists: Callable[[Path], bool]


def _default_codex_bin_resolver_ops() -> CodexBinResolverOps:
    return CodexBinResolverOps(
        installed_codex_path=_installed_codex_path,
        path_exists=lambda path: path.exists(),
    )


def resolve_codex_bin(config: "CodexConfig", ops: CodexBinResolverOps) -> Path:
    if config.codex_bin is not None:
        codex_bin = Path(config.codex_bin)
        if not ops.path_exists(codex_bin):
            raise FileNotFoundError(
                f"Codex binary not found at {codex_bin}. Set CodexConfig.codex_bin "
                "to a valid binary path."
            )
        return codex_bin

    return ops.installed_codex_path()


def _resolve_codex_bin(config: "CodexConfig") -> Path:
    return resolve_codex_bin(config, _default_codex_bin_resolver_ops())


@dataclass(slots=True)
class CodexConfig:
    """Configuration for launching and identifying the local Codex runtime.

    Most callers can use ``Codex()`` without configuration. Set ``codex_bin``
    only when intentionally using a specific local Codex executable.

View on GitHub (pinned to 339751715c)

Solutions

  1. Set CodexConfig.codex_bin to a valid existing codex binary path.

When it happens

Trigger: Thrown at sdk/python/src/openai_codex/client.py:180 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/c394e8d76739387e. Report an issue: GitHub.