{"record":{"id":"cb6e0c098cb06082","repo":"TauricResearch/TradingAgents","slug":"method-method-not-found-in-any-category","errorCode":null,"errorMessage":"Method '{method}' not found in any category","messagePattern":"Method '(.+?)' not found in any category","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tradingagents/dataflows/interface.py","lineNumber":151,"sourceCode":"        \"alpha_vantage\": get_alpha_vantage_insider_transactions,\n        \"yfinance\": get_yfinance_insider_transactions,\n    },\n    # macro_data\n    \"get_macro_indicators\": {\n        \"fred\": get_fred_macro_data,\n    },\n    # prediction_markets\n    \"get_prediction_markets\": {\n        \"polymarket\": get_polymarket_prediction_markets,\n    },\n}\n\ndef get_category_for_method(method: str) -> str:\n    \"\"\"Get the category that contains the specified method.\"\"\"\n    for category, info in TOOLS_CATEGORIES.items():\n        if method in info[\"tools\"]:\n            return category\n    raise ValueError(f\"Method '{method}' not found in any category\")\n\ndef get_vendor(category: str, method: str = None) -> str:\n    \"\"\"Get the configured vendor for a data category or specific tool method.\n    Tool-level configuration takes precedence over category-level.\n    \"\"\"\n    config = get_config()\n\n    # Check tool-level configuration first (if method provided)\n    if method:\n        tool_vendors = config.get(\"tool_vendors\", {})\n        if method in tool_vendors:\n            return tool_vendors[method]\n\n    # Fall back to category-level configuration\n    return config.get(\"data_vendors\", {}).get(category, \"default\")\n\ndef route_to_vendor(method: str, *args, **kwargs):\n    \"\"\"Route method calls to appropriate vendor implementation with fallback support.\"\"\"","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/TauricResearch/TradingAgents/blob/a33fd4c0f134485a43553a2c23a63cb14adbd88f/tradingagents/dataflows/interface.py#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nroute_to_vendor(\"get_stock_data_indicator\", \"AAPL\", ...)  # typo, missing suffix\n# -> ValueError: Method 'get_stock_data_indicator' not found in any category\n\n# after\nfrom tradingagents.dataflows.interface import TOOLS_CATEGORIES\nassert \"get_stock_data_indicators_adjusted\" in TOOLS_CATEGORIES[\"stock_data\"][\"tools\"]\nroute_to_vendor(\"get_stock_data_indicators_adjusted\", \"AAPL\", ...)","handlingStrategy":"validation","validationCode":"from tradingagents.dataflows.interface import TOOLS_CATEGORIES\n\ndef known_methods() -> set[str]:\n    return {m for info in TOOLS_CATEGORIES.values() for m in info[\"tools\"]}\n\ndef dispatch(method: str, *a, **kw):\n    if method not in known_methods():\n        raise ValueError(f\"Unknown method {method!r}; valid: {sorted(known_methods())[:10]}...\")\n    return route_to_vendor(method, *a, **kw)","typeGuard":null,"tryCatchPattern":"try:\n    route_to_vendor(method, *args)\nexcept ValueError as e:\n    if \"not found in any category\" in str(e):\n        # surface valid names to the LLM/caller for correction instead of crashing\n        return f\"Unknown data method {method!r}. Valid examples: {sorted(known_methods())[:5]}\"\n    raise","preventionTips":["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"],"tags":["validation","routing","interface","valueerror","api-contract"],"backgroundTag":null,"analyzedSha":"a33fd4c0f134485a43553a2c23a63cb14adbd88f","analyzedAt":"2026-08-14T19:45:16.920Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}