TauricResearch/TradingAgents · error · ValueError
Method '{method}' not found in any category
Error message
Method '{method}' not found in any category What it means
Raised by get_category_for_method() in tradingagents/dataflows/interface.py when a method name is not a key in any TOOLS_CATEGORIES entry. It is a ValueError that fires before any vendor is consulted — the routing table itself does not know the method. route_to_vendor() hits this first, so misspelled or removed tool names fail here.
Source
Thrown at tradingagents/dataflows/interface.py:151
"alpha_vantage": get_alpha_vantage_insider_transactions,
"yfinance": get_yfinance_insider_transactions,
},
# macro_data
"get_macro_indicators": {
"fred": get_fred_macro_data,
},
# prediction_markets
"get_prediction_markets": {
"polymarket": get_polymarket_prediction_markets,
},
}
def get_category_for_method(method: str) -> str:
"""Get the category that contains the specified method."""
for category, info in TOOLS_CATEGORIES.items():
if method in info["tools"]:
return category
raise ValueError(f"Method '{method}' not found in any category")
def get_vendor(category: str, method: str = None) -> str:
"""Get the configured vendor for a data category or specific tool method.
Tool-level configuration takes precedence over category-level.
"""
config = get_config()
# Check tool-level configuration first (if method provided)
if method:
tool_vendors = config.get("tool_vendors", {})
if method in tool_vendors:
return tool_vendors[method]
# Fall back to category-level configuration
return config.get("data_vendors", {}).get(category, "default")
def route_to_vendor(method: str, *args, **kwargs):
"""Route method calls to appropriate vendor implementation with fallback support."""View on GitHub (pinned to a33fd4c0f1)
Solutions
- Inspect the registry to see valid names: from tradingagents.dataflows.interface import TOOLS_CATEGORIES; print(TOOLS_CATEGORIES)
- Fix the name to the exact registered method (watch _adjusted suffixes and underscores)
- If dispatching LLM tool calls, validate the method name against TOOLS_CATEGORIES before routing and re-prompt with the valid list
- Pin/align the version whose docs you are reading
Example fix
# before
route_to_vendor("get_stock_data_indicator", "AAPL", ...) # typo, missing suffix
# -> ValueError: Method 'get_stock_data_indicator' not found in any category
# after
from tradingagents.dataflows.interface import TOOLS_CATEGORIES
assert "get_stock_data_indicators_adjusted" in TOOLS_CATEGORIES["stock_data"]["tools"]
route_to_vendor("get_stock_data_indicators_adjusted", "AAPL", ...) Defensive patterns
Strategy: validation
Validate before calling
from tradingagents.dataflows.interface import TOOLS_CATEGORIES
def known_methods() -> set[str]:
return {m for info in TOOLS_CATEGORIES.values() for m in info["tools"]}
def dispatch(method: str, *a, **kw):
if method not in known_methods():
raise ValueError(f"Unknown method {method!r}; valid: {sorted(known_methods())[:10]}...")
return route_to_vendor(method, *a, **kw) Try / catch
try:
route_to_vendor(method, *args)
except ValueError as e:
if "not found in any category" in str(e):
# surface valid names to the LLM/caller for correction instead of crashing
return f"Unknown data method {method!r}. Valid examples: {sorted(known_methods())[:5]}"
raise Prevention
- Validate method names against TOOLS_CATEGORIES before dispatch, especially for LLM-driven calls
- Re-read the registry after package upgrades; tool names change between versions
- Write a smoke test asserting the method names your code calls still exist
When it happens
Trigger: Calling route_to_vendor('get_stock_data_indicators') when the registered name is 'get_stock_data_indicators_adjusted'; using a method removed/renamed in a newer version; passing a category name instead of a method name.
Common situations: Upgrading the package and hitting a renamed tool; typos in dispatch code; copy-pasting tool names from outdated docs or prompts; dynamic dispatch from LLM output where the model invented a method name.
Related errors
- Unsupported date format: {date_input}
- Indicator {indicator} is not supported. Please choose from:
- '{indicator}' is not a known macro alias or a valid FRED ser
- Method '{method}' not supported
- Configured vendor(s) {explicit} not available for '{method}'
AI-assisted analysis of TauricResearch/TradingAgents@a33fd4c0f1 (2026-08-14).
Data as JSON: /api/errors/cb6e0c098cb06082.
Report an issue: GitHub.