Checked other resources
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
from langchain_core.structured_query import Visitor, Operator, Comparator
class TestVisitor(Visitor):
allowed_comparators = (Comparator.EQ,)
allowed_operators = (Operator.AND,)
def visit_operation(self, operation):
pass
def visit_comparison(self, comparison):
pass
def visit_structured_query(self, structured_query):
pass
v = TestVisitor()
# Trigger the error with an operator that is not in allowed_operators
v._validate_func(Operator.OR)
Error Message and Stack Trace (if applicable)
ValueError: Received disallowed operator Operator.OR. Allowed comparators are (Operator.AND,)
Description
In Visitor._validate_func (langchain_core/structured_query.py), when an
invalid operator is passed, the error message incorrectly says
"Allowed comparators are ..." instead of "Allowed operators are ...".
This is a copy-paste typo. The message should say "operators" to match
what is actually being validated.
The typo is on line 32:
|
f"Received disallowed operator {func}. Allowed " |
|
f"comparators are {self.allowed_operators}" |
System Info
System Information
OS: Darwin
OS Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:55 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T8132
Python Version: 3.12.11 (main, Jul 23 2025, 00:18:05) [Clang 20.1.4 ]
Checked other resources
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
In
Visitor._validate_func(langchain_core/structured_query.py), when aninvalid operator is passed, the error message incorrectly says
"Allowed comparators are ..." instead of "Allowed operators are ...".
This is a copy-paste typo. The message should say "operators" to match
what is actually being validated.
The typo is on line 32:
langchain/libs/core/langchain_core/structured_query.py
Lines 31 to 32 in 8182d63
System Info
System Information