hermes - 💡(How to fix) Fix codex-oauth: 'NoneType' object is not iterable in _run_codex_stream (gpt-5.5) — every turn fails non-retryably

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…

Every conversation turn through provider=openai-codex / base_url=https://chatgpt.com/backend-api/codex / model=gpt-5.5 fails with TypeError: 'NoneType' object is not iterable inside _run_codex_stream. agent.conversation_loop correctly classifies it as non-retryable, the fallback model goes through the same parser and crashes identically, and the user sees a Discord message that's just the error string.

Crashes began 2026-05-27 ~21:00 MDT with no local code or config change at that time — strongly suggests an upstream codex-backend response-shape change. Running latest main (auto-update ran 2026-05-28 03:00 MDT and pulled the fix-pool / preload-jiter commits); bug persists.

Error Message

Every conversation turn through provider=openai-codex / base_url=https://chatgpt.com/backend-api/codex / model=gpt-5.5 fails with TypeError: 'NoneType' object is not iterable inside _run_codex_stream. agent.conversation_loop correctly classifies it as non-retryable, the fallback model goes through the same parser and crashes identically, and the user sees a Discord message that's just the error string. 2026-05-28 15:40:50,598 ERROR [20260528_154013_68f40a53] agent.conversation_loop: Non-retryable client error: 'NoneType' object is not iterable

Root Cause

Every conversation turn through provider=openai-codex / base_url=https://chatgpt.com/backend-api/codex / model=gpt-5.5 fails with TypeError: 'NoneType' object is not iterable inside _run_codex_stream. agent.conversation_loop correctly classifies it as non-retryable, the fallback model goes through the same parser and crashes identically, and the user sees a Discord message that's just the error string.

Crashes began 2026-05-27 ~21:00 MDT with no local code or config change at that time — strongly suggests an upstream codex-backend response-shape change. Running latest main (auto-update ran 2026-05-28 03:00 MDT and pulled the fix-pool / preload-jiter commits); bug persists.

RAW_BUFFERClick to expand / collapse

Summary

Every conversation turn through provider=openai-codex / base_url=https://chatgpt.com/backend-api/codex / model=gpt-5.5 fails with TypeError: 'NoneType' object is not iterable inside _run_codex_stream. agent.conversation_loop correctly classifies it as non-retryable, the fallback model goes through the same parser and crashes identically, and the user sees a Discord message that's just the error string.

Crashes began 2026-05-27 ~21:00 MDT with no local code or config change at that time — strongly suggests an upstream codex-backend response-shape change. Running latest main (auto-update ran 2026-05-28 03:00 MDT and pulled the fix-pool / preload-jiter commits); bug persists.

Environment

  • hermes-agent commit: 9b5dae17a5c623af5f0331e10f7eb2a164b07f17 (origin/main, clean except untracked HERMES.md)
  • Python 3.11.15, venv install
  • Provider: openai-codex (codex-oauth, ChatGPT account auth)
  • Base URL: https://chatgpt.com/backend-api/codex
  • Model: gpt-5.5
  • Profile: gpt-agent
  • Platform: Discord gateway (hermes-gateway.service)

Repro

Any user message to the bot via Discord. 100% reproducible since 2026-05-27 ~21:00.

Observed logs

From ~/.hermes/profiles/gpt-agent/logs/errors.log:

``` 2026-05-28 15:40:50,333 WARNING [20260528_154013_68f40a53] agent.conversation_loop: API call failed (attempt 1/3) error_type=TypeError thread=asyncio_2 provider=openai-codex base_url=https://chatgpt.com/backend-api/codex model=gpt-5.5 summary='NoneType' object is not iterable 2026-05-28 15:40:50,598 ERROR [20260528_154013_68f40a53] agent.conversation_loop: Non-retryable client error: 'NoneType' object is not iterable ```

Preceding events show a clean stream lifecycle — TCP not force-closed, ~6s request_complete, no TTFB warning. The stream completes and the failure is in parsing the result, not transport:

``` 15:40:44,254 INFO run_agent: OpenAI client created (codex_stream_request, shared=False) ... provider=openai-codex model=gpt-5.5 15:40:50,333 INFO run_agent: OpenAI client closed (request_complete, shared=False, tcp_force_closed=0) 15:40:50,333 WARNING agent.conversation_loop: API call failed ... 'NoneType' object is not iterable ```

Suspected location

agent/run_agent.py:2848_run_codex_stream, called from agent/chat_completion_helpers.py:226. Most likely a for x in <field>: where <field> is a stream-event subfield (delta / content / parts / output) that the codex backend now omits or sends as null for at least one event class.

Notes

  • xAI-oauth gateway profile on the same install is unaffected.
  • Auto-updater pulled main after the bug appeared; it is not yet fixed there.
  • Happy to capture a raw codex stream dump if there's a flag/env to enable event-level logging — point me at it.

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