hermes - 💡(How to fix) Fix openai-codex provider crashes: SDK parse_response fails on null output from Codex backend

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error: 'NoneType' object is not iterable

Root Cause

The ChatGPT Codex backend (chatgpt.com/backend-api/codex) returns output: null in response.completed SSE stream events. The OpenAI Python SDK's parse_response() at openai/lib/_parsing/_responses.py:61 does for output in response.output: with no null guard, crashing the stream parser before Hermes's own backfill logic (in codex_runtime.py) ever runs.

This affects all OpenAI SDK versions through 2.38.0 (latest). Filed upstream: https://github.com/openai/openai-python/issues/3313

Fix Action

Workaround

Patch the installed SDK:

sed -i 's/for output in response.output:/for output in (response.output or []):/' \
  $(python3 -c "import openai; print(openai.__file__.rsplit('/',1)[0])")/lib/_parsing/_responses.py

Note: This patch is overwritten by hermes update or pip install openai.

Code Example

Error: 'NoneType' object is not iterable

---

sed -i 's/for output in response.output:/for output in (response.output or []):/' \
  $(python3 -c "import openai; print(openai.__file__.rsplit('/',1)[0])")/lib/_parsing/_responses.py
RAW_BUFFERClick to expand / collapse

Bug

Hermes v0.14.0 (latest, updated 2026-05-27 with 471 commits pulled) crashes on every hermes chat call when using openai-codex provider with gpt-5.5.

Error: 'NoneType' object is not iterable

Root Cause

The ChatGPT Codex backend (chatgpt.com/backend-api/codex) returns output: null in response.completed SSE stream events. The OpenAI Python SDK's parse_response() at openai/lib/_parsing/_responses.py:61 does for output in response.output: with no null guard, crashing the stream parser before Hermes's own backfill logic (in codex_runtime.py) ever runs.

This affects all OpenAI SDK versions through 2.38.0 (latest). Filed upstream: https://github.com/openai/openai-python/issues/3313

Workaround

Patch the installed SDK:

sed -i 's/for output in response.output:/for output in (response.output or []):/' \
  $(python3 -c "import openai; print(openai.__file__.rsplit('/',1)[0])")/lib/_parsing/_responses.py

Note: This patch is overwritten by hermes update or pip install openai.

Suggested Fix

Either:

  1. Pin to a fixed SDK version once OpenAI patches it
  2. Add a monkey-patch in Hermes's codex transport init that guards the SDK's parse_response
  3. Add the sed patch to hermes update post-install hooks until upstream fixes

Environment

  • Hermes: v0.14.0 (2026.5.16), fully updated
  • OpenAI SDK: 2.24.0 (pinned), tested through 2.38.0
  • Python: 3.11.15
  • Config: provider=openai-codex, model=gpt-5.5, base_url=chatgpt.com/backend-api/codex
  • Auth: valid OAuth token (Plus plan, 93h remaining), no residency constraint
  • VPS: Hostinger

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING