PIIMiddleware "ip" type fails to detect IPv6 addresses, allowing PII leakage
The PIIMiddleware with type="ip" only compiles an IPv4 regex, so IPv6 addresses are not redacted or blocked, causing silent PII leakage to the model.

LangChain
Published reports for this stack, with severity, affected version, and a direct path into each diagnostic.
The PIIMiddleware with type="ip" only compiles an IPv4 regex, so IPv6 addresses are not redacted or blocked, causing silent PII leakage to the model.
LangChain core's count_tokens_approximately assigns a fixed 85 tokens to every image regardless of resolution, causing severe underestimation for high-resolution images and leading to context window overflow failures.
The standard sandbox integration test in langchain-tests expects glob() to return directories (with is_dir=True), but the deepagents BackendProtocol.glob() documentation and all implementations (FilesystemBackend and BaseSandbox) explicitly return only regular files. This causes the test to fail for every sandbox backend implementation.
When a shell command times out, ShellSession.execute restarts the shell but ShellToolMiddleware does not re-run startup_commands. Any shell hardening (ulimit, umask, exported variables, readonly tokens) and working directory are silently lost, while the model is not informed that the session was reset.
The credit card detector in PIIMiddleware uses a regex that only matches 16-digit card numbers, so valid 13-15 digit cards (Amex, Diners Club, legacy Visa) pass through undetected, potentially leaking PII to the model.
The PII detectors for email, IP, and MAC addresses use \b word boundaries which are Unicode-aware. Non-ASCII letters (CJK, Cyrillic, Arabic, accented Latin) are treated as word characters, so the boundary does not trigger between them and an ASCII PII token. This allows PII to pass through unredacted, unblocked, or unmasked.
MarkdownHeaderTextSplitter corrupts chunk content by applying line.strip() and str.isprintable() filtering, which removes tabs, NBSP, and leading whitespace inside fenced code blocks, causing silent data loss during text splitting.
Reading `AIMessage.content_blocks` for a message with a non-standard Anthropic content block containing an `index` key silently deletes that key from the original `message.content` because the fallback branch pops `index` from the same dict object stored in the message. This also affects `model_provider="bedrock"` via bedrock.py importing the same function.
The `_generate` method uses `self.pipeline.task in "translation"` instead of an equality or prefix check, causing valid transformers translation tasks like `translation_en_to_fr` to raise ValueError. It also incorrectly matches empty string.
A before_model middleware hook configured with can_jump_to=["model"] that returns {"jump_to":"model"} crashes create_agent at runtime with KeyError because the conditional edge path map omits the hook's own node name, even though the router resolves "model" to it.
The ChatGPT device login helper in langchain-openai sends form-encoded data to an endpoint that expects JSON, causing HTTP 400. Additionally, the polling and token exchange steps do not match OpenAI's current device authorization flow, making the feature completely inoperative.
ChatDeepSeek's message serialization omits `reasoning_content` from AIMessage.additional_kwargs, causing DeepSeek API 400 errors in multi-turn tool-calling conversations when the model requires the previous reasoning content to be passed back.
When env is not provided to ShellToolMiddleware, _create_resources coerces None to an empty dict, causing host and Codex shell sessions to lose parent environment variables such as PATH, proxy settings, and credentials.
When ripgrep is not installed, FilesystemFileSearchMiddleware falls back to in-process Python regex search on model-controlled patterns, leading to catastrophic backtracking and denial of service.
In LangChain's retry middleware, calculate_delay applies the max_delay cap before adding ±25% jitter, allowing the final delay to reach up to max_delay * 1.25. This causes unexpected longer waits than configured.
When a LangGraph interrupt occurs in an MCP tool call that returns InputRequiredResult, resuming the graph causes MCPAdapter to issue a fresh initial tool call without the original request_state. If the server generates a new input-request key for each initial call, the adapter validates the saved answer against the new key and raises ValueError before sending the answer to the server.
The middleware replaces a trailing string in system message content with a cache_control-only dict, losing the original text.
aggregate_lines_to_chunks() repeatedly appends to a growing string, causing quadratic time complexity when many adjacent lines share the same metadata. The issue is observable with large inputs (e.g., 16,000 paragraphs take ~5.8 seconds) and becomes progressively worse.
When `convert_to_openai_tool` receives a dict that is already in OpenAI tool format (e.g. `{"type": "function", "function": {...}}`) along with `strict=True`, it returns the dict unchanged without adding `strict` or setting `additionalProperties: false`. This silently disables Structured Outputs for `bind_tools` and `with_structured_output`, potentially causing model outputs that do not match the JSON schema.
Streaming CommaSeparatedListOutputParser produces incorrect fields when a quoted CSV field containing a comma is split across chunk boundaries. Non-streaming parsing is correct, but transform/atransform silently corrupts data.
langchain-openrouter streaming paths raise plain ValueError with the numeric error code interpolated into prose, discarding structured error classification and the is_retryable attribute. Callers cannot distinguish retryable 502/429 from non-retryable 401/403. Non-streaming invoke path also fails with a misleading no-choices ValueError because the error field is dropped during SDK parsing.
RemoteGraph's invoke/ainvoke returns message dictionaries instead of BaseMessage instances, causing CompiledSubAgent to produce empty ToolMessage content when used as a subagent. This breaks the parent agent's ability to read subagent results.
Setting max_retries=0 in ChatOpenRouter does not disable retries; the omission of retry_config causes OpenRouter SDK to apply its default backoff policy, leading to unexpected repeated requests and potentially long hangs on 5xx responses.
When an invalid structured-output tool call and an ordinary tool call appear in the same AIMessage, the agent terminates after the first model call without feeding the validation error back to the model. As a result, no retry happens and structured_response is None.
Reading content_blocks on a legacy v0 multimodal block with an id raises TypeError due to duplicate id keyword argument in _convert_legacy_v0_content_block_to_v1.
ToolMessage content that contains standard LangChain content blocks (like images) is forwarded to the OpenRouter API without conversion, leading to a client-side ValidationError. This makes agent threads unrecoverable until history is trimmed.
AsyncBaseTracer in langchain-core fails to forward the `name` argument to `_create_tool_run` and the `response` argument to `_errored_llm_run`, causing async tracers (including `with_alisteners`) to record incorrect run names and lose partial LLM outputs on streaming errors, unlike their sync counterparts.
langchain-core's finalize_tool_call_chunk maps missing tool_call id (None) to "" in the tool_call and server_tool_call branches, causing multiple id-less parallel tool calls to share the same empty id and collide downstream (e.g., deepagents FilesystemMiddleware offloads all to /large_tool_results/unknown). The proposed fix replaces the empty-string fallback with uuid4().hex to guarantee distinct ids.
ChatOpenAI's message conversion discards unknown fields on tool calls (e.g., Gemini's thought_signature) in both directions, causing later provider-side 400 errors in multi-turn tool calling loops.
When an AIMessage has tool_calls explicitly set to an empty list while additional_kwargs still contains the original OpenAI tool call payload, the _backwards_compat_tool_calls validator treats the empty list as missing and re-parses the additional_kwargs, causing the cleared tool calls to reappear after deserialization or model reconstruction.