openai/codex · error · CodexError
{method} response must be a JSON object
Error message
{method} response must be a JSON object What it means
Error "{method} response must be a JSON object" thrown in openai/codex.
Source
Thrown at sdk/python/src/openai_codex/client.py:320
"capabilities": {
"experimentalApi": self.config.experimental_api,
},
},
response_model=InitializeResponse,
)
self.notify("initialized", None)
return result
def request(
self,
method: str,
params: JsonObject | None,
*,
response_model: type[ModelT],
) -> ModelT:
result = self._request_raw(method, params)
if not isinstance(result, dict):
raise CodexError(f"{method} response must be a JSON object")
return response_model.model_validate(result)
def _request_raw(self, method: str, params: JsonObject | None = None) -> JsonValue:
"""Send a JSON-RPC request and wait for the reader thread to route its response."""
request_id = str(uuid.uuid4())
waiter = self._router.create_response_waiter(request_id)
try:
message: JsonObject = {"id": request_id, "method": method}
if params is not None:
message["params"] = params
self._write_message(message)
except BaseException:
self._router.discard_response_waiter(request_id)
raise
item = waiter.get()
if isinstance(item, BaseException):View on GitHub (pinned to 339751715c)
Solutions
- Update the SDK and runtime to matching versions so the method returns a JSON object per the protocol.
When it happens
Trigger: Thrown at sdk/python/src/openai_codex/client.py:320 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/79305b0c32b34ed7.
Report an issue: GitHub.