langchain-ai/langchain · error · ValueError

'{name}' has been removed for security reasons. Usage of th

Error message

'{name}' has been removed for security reasons.

Usage of this utility in environments with user-input paths is a security vulnerability. Out of an abundance of caution, the utility has been removed to prevent possible misuse.

What it means

Error "'{name}' has been removed for security reasons. Usage of this utility in environments with user-input paths is a security vulnerability. Out of an abundance of caution, the utility has been removed to prevent possible misuse." thrown in langchain-ai/langchain.

Source

Thrown at libs/core/langchain_core/utils/image.py:14

"""Utilities for image processing."""

from typing import Any


def __getattr__(name: str) -> Any:
    if name in {"encode_image", "image_to_data_url"}:
        msg = (
            f"'{name}' has been removed for security reasons.\n\n"
            f"Usage of this utility in environments with user-input paths is a "
            f"security vulnerability. Out of an abundance of caution, the utility "
            f"has been removed to prevent possible misuse."
        )
        raise ValueError(msg)
    raise AttributeError(name)

View on GitHub (pinned to e32fa9a52e)

Solutions

  1. Stop calling the removed utility; load image data yourself from a trusted, validated path and pass the bytes or data URI directly.
  2. Never resolve user-supplied filesystem paths for image loading; accept URLs or in-memory data instead.

When it happens

Trigger: Raised unconditionally when a removed image utility (previously usable with user-controlled paths) is called; the utility was removed for security reasons.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langchain@e32fa9a52e (2026-08-14). Data as JSON: /api/errors/f07382259719c5b1. Report an issue: GitHub.