openai/codex · error · TransportClosedError

Codex process closed stdout. stderr_tail={self._stderr_tail(

Error message

Codex process closed stdout. stderr_tail={self._stderr_tail()[:2000]}

What it means

Error "Codex process closed stdout. stderr_tail={self._stderr_tail()[:2000]}" thrown in openai/codex.

Source

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

        return self._approval_handler(
            method,
            params if isinstance(params, dict) else None,
        )

    def _write_message(self, payload: JsonObject) -> None:
        if self._proc is None or self._proc.stdin is None:
            raise TransportClosedError("Codex process is not running")
        with self._lock:
            self._proc.stdin.write(json.dumps(payload) + "\n")
            self._proc.stdin.flush()

    def _read_message(self) -> dict[str, JsonValue]:
        if self._proc is None or self._proc.stdout is None:
            raise TransportClosedError("Codex process is not running")

        line = self._proc.stdout.readline()
        if not line:
            raise TransportClosedError(
                f"Codex process closed stdout. stderr_tail={self._stderr_tail()[:2000]}"
            )

        try:
            message = json.loads(line)
        except json.JSONDecodeError as exc:
            raise CodexError(f"Invalid JSON-RPC line: {line!r}") from exc

        if not isinstance(message, dict):
            raise CodexError(f"Invalid JSON-RPC payload: {message!r}")
        return message


def default_codex_home() -> str:
    return str(Path.home() / ".codex")

View on GitHub (pinned to 339751715c)

Solutions

  1. Inspect the stderr_tail in the message for the crash cause, fix it, and restart the Codex process.

When it happens

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