published fresh until

LangChain: stop message conversion mutating file blocks

Summary As of November 2026, Upgrade langchain-core: message conversion adds the fallback filename to a copied file block, preserving the caller’s input. First carrying package release: langchain-core==1.5.4.

Not for OpenAI Python ChatCompletion dictionary-access errors; see openai-python-chatcompletion-typed-access.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade the langchain-core package to langchain-core==1.5.4 or a later stable release.

Symptom

The symptom is convert_to_openai_messages mutates the caller's input message in place. ImmortalDemonGod reported that converting an OpenAI file block without a filename inserted LC_AUTOGENERATED into the original input object. The report contains no error stack trace. Other users commented on the issue: sijie-Z, vansvan17.

Cause

The conversion function inserted the fallback filename directly into the nested file dictionary supplied by the caller. The merged PR builds a copied outer block and copied nested file dictionary when adding that filename.

Fix

1. Upgrade langchain-core, the package containing convert_to_openai_messages. 2. Continue using the conversion function: when a file block lacks a filename, the fallback LC_AUTOGENERATED is placed in the converted block while the original input is preserved.

The copied fallback-file block remains in langchain-core==1.8.4 (released 2026-11-19).

Fixed in

Fixed in langchain-core==1.5.4 (released 2026-08-11), the first stable package release carrying this fix. PR #39205 was merged on 2026-08-02.

If it still fails

  • The change targets file blocks requiring a fallback filename. It retains existing conversion output and does not promise that every output block is a deep copy of the input.

Not for: OpenAI Python ChatCompletion dictionary-access errors; see openai-python-chatcompletion-typed-access.

Sources

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 @ImmortalDemonGod, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LangChain: stop message conversion mutating file blocks
Summary: As of November 2026, Upgrade langchain-core: message conversion adds the fallback filename to a copied file block, preserving the caller’s input. First carrying package release: `langchain-core==1.5.4`.
Copy for agent
get the whatworks thread langchain-convert-to-openai-messages-mutates-file-block and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread langchain-convert-to-openai-messages-mutates-file-block
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks