Skip to content

Stream disconnected before completion (invalid type: null, expected struct Error) #6710

Closed

Description

@voytas75

What version of Codex is running?

codex-cli 0.58.0 and 0.59.0-alpha.5

What subscription do you have?

azureopenai

Which model were you using?

gpt-5-codex and 5.1-codex

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64 (codex in WSL2)

What issue are you seeing?

i am on WSL2 Ubuntu@latest and working on python project. Prompted to analyze project and suggest features which was OK. codex suggests. when i choose one idea it started planning, exploring, updating files and unexpectedly thows below:
■ stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error

prompt him to continue and after a few steps it's the same. it can finish implementing a feature. the error appears several times during the work process and regardless of the type of work I do with Codex

What steps can reproduce the bug?

idk, random. maybe a size of project > small.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    bug
    on Nov 15, 2025
  2. added
    CLI
    windows-os
    azure
    on Nov 15, 2025
  3. voytas75 commented on Nov 15, 2025

    @voytas75
    Author

    Issues were reviewed and none were found with this error: stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error

  4. voytas75 commented on Nov 15, 2025

    @voytas75
    Author

    NOTE: i moved to 0.59.0-alpha.5 i do not see the error, only reconections but rarely

    EDIT: 1h working and was fine :) wrote that's fine received ■ stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error, hahaha. :/

  5. voytas75 commented on Nov 15, 2025

    @voytas75
    Author

    jump on 5.1-codex = same situation :(

  6. antonsoo commented on Nov 15, 2025

    @antonsoo

    Same

  7. thingersoft commented on Nov 16, 2025

    @thingersoft

    Same here — it seems to occur more frequently when using the *-codex models.

  8. datacatalyst-io commented on Nov 17, 2025

    @datacatalyst-io

    Same issue on GPT-5. Rolling back to o3 fixes it. codex-cli 0.58.0

    Uploaded thread: 019a8beb-ca38-7e33-bf88-bf3879ae83f5

    Have closed my duplicate post.

  9. christianvossCaeli commented on Nov 17, 2025

    @christianvossCaeli

    Same here, even on 0.59.0-alpha.5

  10. vikduf commented on Nov 17, 2025

    @vikduf

    Same issue, started happening after 5.1 upgrade (am on azure aswell)

  11. gadogado commented on Nov 18, 2025

    @gadogado

    seeing the same behavior for azure on 0.59.0-alpha.6

  12. Zanzavar commented on Nov 18, 2025

    @Zanzavar

    same issue here, on azure as well, started happening after 5.1

  13. 9 remaining items

  14. ChrisEdwards commented on Nov 20, 2025

    @ChrisEdwards

    I am getting this issue on a my mac. Upgraded to 0.60.1 and same problem. It fails with gpt-5-codex and gpt-5.1-codex. It is utterly unusable at this point.

  15. snehginb commented on Nov 21, 2025

    @snehginb

    Same here as well, tried latest codex-cli 0.61.0 (windows) and still getting"stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error"

  16. leonarddai-solutino commented on Nov 21, 2025

    @leonarddai-solutino

    same issue here after upgrading to 0.61.0 (Mac) using azure.
    codex with openai chatgpt subscription works fine

  17. datacatalyst-io commented on Nov 21, 2025

    @datacatalyst-io

    If anyone has Azure support, it's probably worth reporting it there. This isn't a bug in either Azure or Codex per se, it's an integration problem between them. Given that one likely response is to shift from the Azure API to the direct Open AI API (= what we have done), I think Microsoft will be more motivated to fix this than OpenAI...

  18. jfreemanwbd commented on Nov 21, 2025

    @jfreemanwbd

    I reported this to Azure support their suggestion was to up the TKM on the deployed model, this has mostly resolved my issues. I'm going to share this thread with my CSM and the support ticket.

  19. snehginb commented on Nov 21, 2025

    @snehginb

    I reported this to Azure support their suggestion was to up the TKM on the deployed model, this has mostly resolved my issues. I'm going to share this thread with my CSM and the support ticket.

    @jfreemanwbd Is there any recommendation on what could be a decent TPM, we use it for some PoC only and default 100K was good enough till this stream error popped up?

  20. jfreemanwbd commented on Nov 21, 2025

    @jfreemanwbd

    Out of frustration I just doubled ours to 300k yesterday AM and it's been mostly good, I've not had the error today with some light use, but it did still pop up occasionally yesterday afternoon.

    I guess what I'm really wondering about is how we could have been hitting 150k TPM with just myself and one other user on the deployment. Support was unable to point to any place that an error was surfaced indicating this was actually the problem. I'm also going to post this thread in the Microsoft Foundry Discord.

  21. azhar-alhasan commented on Nov 25, 2025

    @azhar-alhasan

    It is so annoying; it’s starting to occur way too frequently. :(

    Setup:
    Version: v0.63.0
    Model: gpt-5.1-codex (medium)
    MacOs, VSCode

    Error:
    ■ stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error

    › continue

    • Explored
    └ Search progressive in api
    Read composer.py
    Search PayloadGenerator in src
    Search build_adapter_registry
    Read init.py

    ■ stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error

    › continue

    • Explored
    └ List ls
    Read architecture.md
    Search progressive in architecture.md
    Search adapter in architecture.md

    ■ stream disconnected before completion: failed to parse ErrorResponse: invalid type: null, expected struct Error

  22. JariHuomo commented on Nov 25, 2025

    @JariHuomo

    Higher TPM is a workaround, not a fix. The original error is due to rate-limiting but should be handled gracefully. That null is returned throws the breaking error.

    This workaround resolved the issue for me. I set the TPM as high as I could and the errors stopped.

  23. adamal commented on Nov 26, 2025

    @adamal

    Also on azure. Getting this on gpt-5-codex with 200K TpM and gpt-5.1-codex with 100K TpM. I don't see any options to increase, but I can fill out a form to request a quota increase.

    On macOS, so issue seems mislabeled.

    Also, it does not feel like it is TPM-related. Feels more like time-of day.

    E.g. I have been using codex heavily for a few hours, with it taking many iterations and working for a long time. No issue. Then it started popping up. Went looking for a solution. Came here, read the thread. Posted a message. 15 min later, it errors out with this error almost immediately.

  24. removed
    windows-os
    on Nov 26, 2025
  25. eavidal commented on Nov 27, 2025

    @eavidal

    FYI increasing my TPM did the trick for me too

  26. Pillen commented on Dec 1, 2025

    @Pillen

    I have exaclty the same issue: using GPT-5, GPT-5-codex, GPT-5.1, GPT-5.1-codex models. I've got it in both the codex CLI in windows, as in the CLI using WSL2. I'm working with my own deployed models on Azure AI Foundry.

    I don't have the luxury of being able to increase my TPM, but changing the following setting in the config.toml fixed the issue for me..

    stream_max_retries = 100

    I see the retries move up to 7 or 8 now, and then continue, where it would have previously failed.
    Still this is a workaround, not a solution.

    Edit: Also happening with GPT-5.2
    Edit2: And with GPT-5.2-Codex

  27. etraut-openai commented on Mar 29, 2026

    @etraut-openai
    Contributor

    This bug report hasn't received any new upvotes or posts in over two months. I presume that the issue has been fixed on the Azure side. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIazurebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions