openai/codex · error · CodexError
Invalid JSON-RPC payload: {message!r}
Error message
Invalid JSON-RPC payload: {message!r} What it means
Error "Invalid JSON-RPC payload: {message!r}" thrown in openai/codex.
Source
Thrown at sdk/python/src/openai_codex/client.py:859
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
- Update SDK and runtime to matching protocol versions; the process emitted a malformed JSON-RPC payload.
When it happens
Trigger: Thrown at sdk/python/src/openai_codex/client.py:859 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/4f6557c8ae1ba9f9.
Report an issue: GitHub.