{"record":{"id":"c26e1521d916b597","repo":"TauricResearch/TradingAgents","slug":"unknown-analyst-key-analyst-key","errorCode":null,"errorMessage":"unknown analyst key: {analyst_key}","messagePattern":"unknown analyst key: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tradingagents/graph/analyst_execution.py","lineNumber":63,"sourceCode":"    ),\n    \"fundamentals\": AnalystNodeSpec(\n        key=\"fundamentals\",\n        agent_node=\"Fundamentals Analyst\",\n        clear_node=\"Msg Clear Fundamentals\",\n        tool_node=\"tools_fundamentals\",\n        report_key=\"fundamentals_report\",\n    ),\n}\n\n\ndef build_analyst_execution_plan(\n    selected_analysts: Iterable[str],\n) -> AnalystExecutionPlan:\n    specs: list[AnalystNodeSpec] = []\n    for analyst_key in selected_analysts:\n        spec = ANALYST_NODE_SPECS.get(analyst_key)\n        if spec is None:\n            raise ValueError(f\"unknown analyst key: {analyst_key}\")\n        specs.append(spec)\n\n    if not specs:\n        raise ValueError(\"at least one analyst must be selected\")\n\n    return AnalystExecutionPlan(specs=specs)\n\n\ndef get_initial_analyst_node(plan: AnalystExecutionPlan) -> str:\n    return plan.specs[0].agent_node\n\n\nclass AnalystWallTimeTracker:\n    def __init__(self, plan: AnalystExecutionPlan):\n        self.plan = plan\n        self._started_at: dict[str, float] = {}\n        self._wall_times: dict[str, float] = {}\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/TauricResearch/TradingAgents/blob/a33fd4c0f134485a43553a2c23a63cb14adbd88f/tradingagents/graph/analyst_execution.py#L45-L81","documentation":"ValueError raised by build_analyst_execution_plan (tradingagents/graph/analyst_execution.py) when one of the selected_analysts strings has no entry in the ANALYST_NODE_SPECS registry. Valid keys are the fixed analyst names the graph knows how to run (market, social, news, fundamentals). Any other string — wrong casing, abbreviation, typo — fails immediately.","triggerScenarios":"Passing selected_analysts=('markets', 'news') or ('mkt',) to TradingAgentsGraph / build_analyst_execution_plan; also forwarding user or LLM-provided analyst names without validation.","commonSituations":"Typos or plural forms ('markets' vs 'market'), renamed keys after upgrading the library, config files carrying outdated analyst lists, case-sensitive mismatches ('Market').","solutions":["Use the exact registry keys: 'market', 'social', 'news', 'fundamentals' (check ANALYST_NODE_SPECS for the authoritative set).","Validate/normalize the list against ANALYST_NODE_SPECS before constructing the graph.","After upgrading the package, re-check the supported analyst keys if your config worked before."],"exampleFix":"# before\nTradingAgentsGraph(selected_analysts=('markets', 'news'))\n\n# after\nTradingAgentsGraph(selected_analysts=('market', 'news'))","handlingStrategy":"validation","validationCode":"from tradingagents.graph.analyst_execution import ANALYST_NODE_SPECS\n\ndef normalize_analysts(selected) -> tuple[str, ...]:\n    keys = tuple(a.strip().lower() for a in selected)\n    unknown = [a for a in keys if a not in ANALYST_NODE_SPECS]\n    if unknown:\n        raise ValueError(f'unknown analysts {unknown}; valid: {sorted(ANALYST_NODE_SPECS)}')\n    return keys","typeGuard":null,"tryCatchPattern":"try:\n    graph = TradingAgentsGraph(selected_analysts=selected)\nexcept ValueError as e:\n    if 'unknown analyst key' in str(e):\n        selected = ('market', 'news')  # or surface the valid-keys error to the user\n        graph = TradingAgentsGraph(selected_analysts=selected)\n    else:\n        raise","preventionTips":["Source analyst names from ANALYST_NODE_SPECS, never hardcode them in app config.","Normalize case/whitespace on analyst input from users or YAML.","Re-validate your config after package upgrades."],"tags":["validation","configuration","analysts","graph"],"backgroundTag":null,"analyzedSha":"a33fd4c0f134485a43553a2c23a63cb14adbd88f","analyzedAt":"2026-08-14T19:45:16.920Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}