langchain-ai/langgraph · error · DeprecationWarning
Setting attribute '{name}' on ToolCallRequest is deprecated.
Error message
Setting attribute '{name}' on ToolCallRequest is deprecated. Use the override() method instead to create a new instance with modified values. What it means
Error "Setting attribute '{name}' on ToolCallRequest is deprecated. Use the override() method instead to create a new instance with modified values." thrown in langchain-ai/langgraph.
Source
Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:162
"""
tool_call: ToolCall
tool: BaseTool | None
state: Any
runtime: ToolRuntime
def __setattr__(self, name: str, value: Any) -> None:
"""Raise deprecation warning when setting attributes directly.
Direct attribute assignment is deprecated. Use the `override()` method instead.
"""
import warnings
# Allow setting attributes during initialization
if not hasattr(self, "__dataclass_fields__") or not hasattr(self, name):
object.__setattr__(self, name, value)
else:
warnings.warn(
f"Setting attribute '{name}' on ToolCallRequest is deprecated. "
"Use the override() method instead to create a new instance with modified values.",
DeprecationWarning,
stacklevel=2,
)
object.__setattr__(self, name, value)
def override(
self, **overrides: Unpack[_ToolCallRequestOverrides]
) -> ToolCallRequest:
"""Replace the request with a new request with the given overrides.
Returns a new `ToolCallRequest` instance with the specified attributes replaced.
This follows an immutable pattern, leaving the original request unchanged.
Args:
**overrides: Keyword arguments for attributes to override.
View on GitHub (pinned to 38031739e5)
When it happens
Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:162 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/35ec789a389ed6a8.
Report an issue: GitHub.