Skip to content

Subsequent calls fail with 400 after double interruption; error: “reasoning item without required following item” #5778

Open

Description

@nikhil-pandey

What version of Codex is running?

0.48.0

What subscription do you have?

Azure OpenAI

Which model were you using?

gpt-5-codex

What platform is your computer?

Linux 6.11.0-1018-azure x86_64 x86_64

What issue are you seeing?

After interrupting a conversation twice, all subsequent calls in the same conversation start failing with HTTP 400. Error payload:

unexpected status 400 Bad Request: {
  "error": {
    "message": "Item 'rs_0b39bd1ac8bba0a30068fe759efeb88194a5b7e134cb54c8bb' of type 'reasoning' was provided without its required following item.",
    "type": "invalid_request_error",
    "param": "input",
    "code": null
  }
}

This happens even when sending a simple follow-up user message; the server consistently returns the same 400 until the conversation is abandoned and a new one is created.

Context: I interrupted the same streamed response twice with “Conversation interrupted — tell the model what to do differently”, then continued the thread. I’m using Azure OpenAI.

What steps can reproduce the bug?

What is the expected behavior?

Interrupting an in-flight streamed response (even multiple times) should not corrupt conversation state.

Additional information

No response

Activity

  1. added
    bug
    on Oct 26, 2025
  2. added
    azure
    on Oct 26, 2025
  3. nikhil-pandey commented on Oct 28, 2025

    @nikhil-pandey
    Author

    This has been happening quite often lately

  4. voytas75 commented on Oct 30, 2025

    @voytas75

    in my case the 400 starded today after updating to v0.52.0. first interaction with codex is OK the second ends with reconnecting and 400. restart helps.

  5. Arthur742Ramos commented on Oct 30, 2025

    @Arthur742Ramos

    For me as well, issue appeared after updating to v0.52.0

  6. voytas75 commented on Oct 31, 2025

    @voytas75

    v0.53.0 - no 400 error - works seamless

  7. nikhil-pandey commented on Nov 3, 2025

    @nikhil-pandey
    Author

    This issue is occurring less frequently, but it has happened twice with me in the past few days with version 0.53.0. @etraut-openai

  8. nikhil-pandey commented on Nov 10, 2025

    @nikhil-pandey
    Author

    This issue still occurs in v0.57.0-alpha.3. To reproduce easily:

    1. Send a message that triggers reasoning in the model.
    2. Interrupt the model while it's reasoning.
    3. After that, subsequent messages fail to process.

    However, restarting and resuming the session seems to resolve the issue temporarily.

  9. voytas75 commented on Nov 12, 2025

    @voytas75

    @nikhil-pandey true - Today I came across this problem: canceling the request and re-query = 400.
    Restarting helps.

  10. geokal commented on Nov 20, 2025

    @geokal

    same here !!!! out of the blue

    VS CODE:
    Version: 1.106.2 (Universal)
    Commit: 1e3c50d64110be466c0b4a45222e81d2c9352888
    Date: 2025-11-19T16:56:50.023Z (18 hrs ago)
    Electron: 37.7.0
    ElectronBuildId: 12781156
    Chromium: 138.0.7204.251
    Node.js: 22.20.0
    V8: 13.8.258.32-electron.0
    OS: Darwin arm64 22.6.0

    codex extension
    0.4.46

  11. nikhil-pandey commented on Dec 24, 2025

    @nikhil-pandey
    Author

    has been happening quite a lot lately

  12. danielgwilson commented on Jan 12, 2026

    @danielgwilson

    Still getting with Codex CLI v0.80.0

  13. etraut-openai commented on Jan 12, 2026

    @etraut-openai
    Contributor

    I presume all of you are using the Azure-hosted OpenAI models? If you're seeing this error and are not using the Azure endpoints, please let us know.

    Are you using the "chat" or "responses" wire API in your model provider definition? If you're using the former, please switch to the latter. If you don't specify a "wire_api", Codex currently defaults to "chat". But we'll be removing support for "chat" at the end of the month.

  14. tkellogg commented on Mar 5, 2026

    @tkellogg

    Alright, this is extremely frustrating because it's been happening for months and bug reports are repeatedly being closed with no acknowledgement, or even a good reason for why it should be closed.

    I'm using responses. It's March, so clearly chat API isn't supported anyway (according to your previous message), and this still happens on a daily basis.

    ❯ codex --version
    codex-cli 0.110.0
    
    ❯ cat ~/.codex/config.toml
    model_provider = "azure"
    profile = "gpt-52-xhigh"
    disable_response_storage = true
    
    request_max_retries    = 15    # HTTP retries
    stream_max_retries     = 15   # SSE reconnects
    stream_idle_timeout_ms = 600000
    
    [profiles.gpt-52-xhigh]
    model_provider = "azure"
    model = "gpt-5.2"
    model_reasoning_effort = "xhigh"
    
    [model_providers.azure]
    name = "Azure"
    base_url = "https://....openai.azure.com/openai"
    env_key = "AZURE_OPENAI_API_KEY"
    # Newer versions appear to support the responses API, see https://github.com/openai/codex/pull/1321
    query_params = { api-version = "2025-04-01-preview" }
    wire_api = "responses"
    
  15. tkellogg commented on Mar 5, 2026

    @tkellogg

    I just upgraded to gpt-5.3-codex xhigh and the problem is significantly worse. Codex is basically unusable.

    FWIW I've found openclaw/openclaw#1158 that seems potentially related. I changed from 2025-04-01-preview to v1 to no avail, it behaves the same.

  16. etraut-openai commented on Mar 6, 2026

    @etraut-openai
    Contributor

    @tkellogg, have you reported this to Azure? I don't think we've heard of reports of this problem for OpenAI-hosted endpoints, which means that this is likely a problem that's specific to Azure's responses implementation or infrastructure. If you haven't reported it to them, they likely won't be aware of the issue.

  17. tkellogg commented on Mar 6, 2026

    @tkellogg

    @etraut-openai no, i haven't. But I'm fairly sure it's the --search flag to blame. I pointed GPT-5.3-codex at codex's own code for the purpose of verifying this hunch, and the over-eager mofo fixed the bug. I haven't verified manually yet, but the diff isn't as big as I thought it would be and it looks plausible (it's on my gh fork): tkellogg@dcabb75

    In GPT's words:

    The bug was in stream handling: we only persisted incremental response.output_item.* items, but Azure can put reasoning only in response.completed.response.output. That left replay history missing reasoning, so the next request could contain an orphan function_call and Azure returned the 400 (reasoning ... without required following item).

  18. etraut-openai commented on Mar 6, 2026

    @etraut-openai
    Contributor

    @tkellogg, if your analysis is correct, then this appears to be an Azure bug. This limitation doesn't exist in the OpenAI responses implementation. As you might guess, we're reluctant to add Azure-specific work-arounds in the Code base. Please report the problem to Azure.

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

    azurebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions