{"record":{"id":"390e636283fde118","repo":"HKUDS/Vibe-Trading","slug":"unknown-section-name-valid-join-all-s","errorCode":null,"errorMessage":"unknown section '{name}'; valid: {', '.join(_ALL_SECTIONS)}","messagePattern":"unknown section '(.+?)'; valid: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/tools/stock_profile_tool.py","lineNumber":220,"sourceCode":"def _resolve_sections(sections: Optional[List[str]]) -> List[str]:\n    \"\"\"Validate the requested sections, defaulting to all when omitted.\n\n    Args:\n        sections: Requested section names, or ``None`` for every section.\n\n    Returns:\n        An ordered, de-duplicated list of valid section names.\n\n    Raises:\n        ValueError: If any requested name is not a supported section.\n    \"\"\"\n    if not sections:\n        return list(_ALL_SECTIONS)\n    resolved: List[str] = []\n    for name in sections:\n        key = str(name).strip().lower()\n        if key not in _SECTION_MODULES:\n            raise ValueError(\n                f\"unknown section '{name}'; valid: {', '.join(_ALL_SECTIONS)}\"\n            )\n        if key not in resolved:\n            resolved.append(key)\n    return resolved\n\n\ndef _market_for(ticker: str) -> str:\n    \"\"\"Classify a ticker into a coarse market label for the envelope.\"\"\"\n    return \"hk\" if ticker.strip().upper().endswith(\".HK\") else \"us\"\n\n\nclass StockProfileTool(BaseTool):\n    \"\"\"Company profile: key stats, analyst estimates, and ownership.\"\"\"\n\n    name = \"get_stock_profile\"\n    description = (\n        \"Fetch a read-only company profile for a US or Hong Kong listing from \"","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/tools/stock_profile_tool.py#L202-L238","documentation":"The stock_profile tool resolves a `sections` argument against a fixed set of known section names (_SECTION_MODULES keys). Each requested name is normalized (strip+lowercase) and must match a known section; unknown names raise ValueError listing all valid sections. This prevents loading nonexistent profile sections.","triggerScenarios":"Calling stock_profile with sections=[\"overview\", \"fundamentals\"] where one name isn't in _ALL_SECTIONS; typos like \"valuaton\"; names not in the module registry despite being mentioned in docs of a different version.","commonSituations":"Docs/tool-schema drift between versions where a section was renamed or removed; agents hallucinating section names; casing/spelling mistakes (these are auto-lowercased, but wrong words still fail).","solutions":["Read the error message: it enumerates every valid section; use only those names","Update the tool package if you expect a section that the installed version doesn't register","Remove or correct the offending entry in the sections list"],"exampleFix":"# before\ntool.execute(symbol=\"AAPL\", sections=[\"valuaton\"])\n# after\ntool.execute(symbol=\"AAPL\", sections=[\"valuation\"])  # use a name from the error's valid list","handlingStrategy":"validation","validationCode":"from agent.src.tools.stock_profile_tool import _ALL_SECTIONS\nsections = [s for s in requested if str(s).strip().lower() in set(_ALL_SECTIONS)]\nif not sections:\n    sections = list(_ALL_SECTIONS)\ntool.execute(symbol=symbol, sections=sections)","typeGuard":"def valid_section(name: str) -> bool:\n    return str(name).strip().lower() in _ALL_SECTIONS","tryCatchPattern":null,"preventionTips":["Source the valid section list from the tool itself rather than hardcoding","Omit sections to get all sections when unsure"],"tags":["stock-profile","sections","enum-validation","invalid-value"],"backgroundTag":"enum-value-not-allowed","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}