openai/codex · error · FileNotFoundError

Unable to locate the pinned Codex runtime. Install the…

Error message

Unable to locate the pinned Codex runtime. Install the published SDK build with its {RUNTIME_PKG_NAME} dependency, or set CodexConfig.codex_bin explicitly.

What it means

The pinned Codex runtime could not be located: importing codex_cli_bin (which provides bundled_codex_path) raised ImportError, and no explicit CodexConfig.codex_bin was set. The SDK install is missing its runtime dependency, so there is no binary to spawn.

Solutions

  1. Reinstall the SDK with its pinned runtime dependency, or set CodexConfig.codex_bin to an explicit binary path.
Defensive patterns

Strategy: fallback

When it happens

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

Appendix: source

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

    if hasattr(params, "model_dump"):
        dumped = params.model_dump(
            by_alias=True,
            exclude_none=True,
            mode="json",
        )
        if not isinstance(dumped, dict):
            raise TypeError("Expected model_dump() to return dict")
        return dumped
    if isinstance(params, dict):
        return params
    raise TypeError(f"Expected generated params model or dict, got {type(params).__name__}")


def _installed_codex_path() -> Path:
    try:
        from codex_cli_bin import bundled_codex_path
    except ImportError as exc:
        raise FileNotFoundError(
            "Unable to locate the pinned Codex runtime. Install the published SDK build "
            f"with its {RUNTIME_PKG_NAME} dependency, or set CodexConfig.codex_bin "
            "explicitly."
        ) from exc

    return bundled_codex_path()


def _installed_codex_path_dirs() -> tuple[Path, ...]:
    try:
        from codex_cli_bin import bundled_path_dir
    except (ImportError, AttributeError):
        return ()

    path_dir = bundled_path_dir()
    return (path_dir,) if path_dir is not None else ()

View on GitHub (pinned to 339751715c)