Skip to content

Disconnected Stream #8838

Closed
Closed

Description

@aris997

What version of Codex is running?

codex-cli 0.79.0

What subscription do you have?

Using OPENAI_API_KEY (Tier 5)

Which model were you using?

gpt-5.1-codex-max

What platform is your computer?

Linux 6.14.0-37-generic x86_64 x86_64

What issue are you seeing?

■ stream disconnected before completion: error sending request for url (https://api.openai.com/v1/responses)

What steps can reproduce the bug?

Just asking the model to /init the folder, request sent via curl to gpt-4o-mini works but gpt-5.1-codex-xx do not works

Uploaded thread: 019b993d-56fc-7211-8f5e-e60280829d8e

What is the expected behavior?

No response

Additional information

No response

Activity

  1. etraut-openai commented on Jan 7, 2026

    @etraut-openai
    Contributor

    Do you have a config.toml file? If so, what options do you have configured in it?

    Do you suspect that this was a regression with 0.79? Was this working previously?

  2. aris997 commented on Jan 7, 2026

    @aris997
    Author

    No I don't have a config.toml file, actually I was on 0.77.x, I thought it was an update issue, so I closed the chat, updated the npm package. But still the same issue.

  3. aris997 commented on Jan 8, 2026

    @aris997
    Author

    It may be related: today (2026-01-08 14-50-00 UTC) I tried to use codex with the same configs (0.79.0, GPT-5.1-codex-max, GNU/Linux Ubuntu 24.04) and I get a different response: 401 Unauthorized. I checked my API KEY is still valid.

    API KEY was refreshed yesterday to prevent API KEY related problems.

    Uploaded a new feedback with thread ID 019b9e17-df3f-7ca0-bfd7-976ec216ef1e.

  4. etraut-openai commented on Jan 9, 2026

    @etraut-openai
    Contributor

    That seems to indicate that the API key you're using is not valid (e.g. the key is corrupt/incorrect or has been revoked).

    Here's what I recommend:

    1. Log out and log back in with your existing API key
    2. Allocate a new API key and try that
  5. aris997 commented on Jan 9, 2026

    @aris997
    Author

    Okay, just allocated a new api key.

    Tested codex with same environment (same project, folder, OS, codex 0.79.0, model GPT-5.1-codex-max medium), it's back to disconnected stream error. Traceback thread ID is 019ba1df-38ad-7be1-a0ee-7f341cee443b.

    Tested the api key with a simple curl query to check working:

    $ curl https://api.openai.com/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $OPENAI_API_KEY" \
      -d '{
        "model": "gpt-4.1",
        "input": "Tell me a three sentence bedtime story about a unicorn."
      }'
    {
      "id": "resp_0315251588f5d51c006960bdd0df18819782a2fa615de1b712",
     ... # omissis #
    }
  6. etraut-openai commented on Jan 9, 2026

    @etraut-openai
    Contributor

    Based on the logs, this looks like a basic network connectivity issue. Do you have any network proxy, VPN, or firewall configured on your machine or network? I think you'll need to do some diagnosis of your system to fix this.

  7. aris997 commented on Jan 12, 2026

    @aris997
    Author

    I double-checked and the latest issue (updated to 0.80.0) was again 401 Unauthorized.
    I found that Codex stores the last working API_KEY in ~/.codex/auth.json. After renaming that file and running Codex again, it prompted me to confirm the current environment API_KEY and then saved it to the same location.
    So rotating OPENAI_API_KEY isn’t straightforward if the cached key is still present.
    I also haven’t encountered the stream disconnect bug again.
    Everything is working now. Thanks for the support.

  8. aris997 commented on Jan 12, 2026

    @aris997
    Author

    Indeed just found that connecting via a specific connection (Company intranet via eth) the stream gets disconnected.

    Also connecting via VPN, company connection blocks it. 019bb273-5bb9-7fb1-aebc-4dff19ce1b2f.

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

    CLIIssues related to the Codex CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions