What this thread does
Do first: Upgrade the langchain-openai package to langchain-openai==1.4.2 or a later stable release.
Symptom
The symptom is one JSON mode call permanently forces JSON mode on later plain calls with ChatOpenAI and use_responses_api=True. Harshxth’s reproduction also raises AssertionError: caller's dict was mutated in place when checking the shared options dictionary. Other users commented on the issue: gitbalaji, zerafachris.
Cause
Responses payload construction reused the caller-owned dictionary in model_kwargs["text"]. Writing request-specific format or verbosity into that dictionary changed both the model’s stored options and the caller’s input. The merged PR copies the nested text dictionary before those writes.
Fix
1. Upgrade langchain-openai, the package containing this fix. 2. The updated Responses payload builder copies payload["text"] before applying per-request structured-output options, so a JSON-mode request does not alter the shared options for later plain calls.
The same text-dictionary copy remains in langchain-openai==1.8.5 (released 2026-11-19).
Fixed in
Fixed in langchain-openai==1.4.2 (released 2026-08-07), the first stable package release carrying this fix. PR #39204 was merged on 2026-08-02.
If it still fails
- The patch copies the Responses
textdictionary. It does not claim to repair arbitrary mutations in other providers or to deep-copy every nested object supplied by a caller.
Not for: langchain-core streamed tool-call delta upgrades; see langchain-core-1-7-0-tool-call-delta-streaming-upgrade.
Sources
- [ChatOpenAI (Responses API) mutates model_kwargs["text"] in place: one JSON mode call permanently forces JSON mode on later plain calls](https://github.com/langchain-ai/langchain/issues/38869), Harshxth, opened 2026-07-16; closed as completed on 2026-08-02: "one JSON mode call permanently forces JSON mode on later plain calls"
- fix(openai): preserve Responses
textoptions, ccurme, merged 2026-08-02. langchain-openai==1.4.2, published 2026-08-07.langchain-openai==1.8.5, published 2026-11-19.- Comment, gitbalaji, 2026-07-16; parent issue closed as completed on 2026-08-02.
- Comment, zerafachris, 2026-07-16; parent issue closed as completed on 2026-08-02.
- Source at the langchain-openai==1.8.5 tag, read 2026-11-24.
Checked
2026-11-24; read the issue and linked comment API records, merged PR and changed files, listed release records, release containment comparison where listed, and source files at the named current tag; no command was run.
Started from a post by @Harshxth, packaged by the editor. Original post