{"record":{"id":"f6de5632f0420da8","repo":"HKUDS/Vibe-Trading","slug":"name-must-be-a-boolean-got-value-r","errorCode":null,"errorMessage":"{name} must be a boolean, got {value!r}","messagePattern":"(.+?) must be a boolean, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/tools/strategy_discovery_tool.py","lineNumber":123,"sourceCode":"            f\"max {_MAX_STRING_PARAM_CHARS})\"\n        )\n    text = value.strip()\n    return text or None\n\n\ndef _coerce_bool(value: Any, name: str, default: bool) -> bool:\n    \"\"\"Coerce a boolean parameter, tolerating common LLM string forms.\"\"\"\n    if value is None:\n        return default\n    if isinstance(value, bool):\n        return value\n    if isinstance(value, str):\n        lowered = value.strip().lower()\n        if lowered in {\"true\", \"1\", \"yes\"}:\n            return True\n        if lowered in {\"false\", \"0\", \"no\"}:\n            return False\n    raise ValueError(f\"{name} must be a boolean, got {value!r}\")\n\n\nclass ListStrategiesTool(BaseTool):\n    \"\"\"List discoverable strategies from Alpha Zoo and the SDM store.\"\"\"\n\n    name = \"list_strategies\"\n    description = (\n        \"List discoverable strategies across the Alpha Zoo registry and the \"\n        \"SDM strategy store. Read-only catalogue of what strategies exist \"\n        \"(identification metadata only). Rows carry evidence status; use \"\n        \"get_strategy_evidence for the per-regime evidence behind any \"\n        \"strategy. Nothing here is a recommendation — rows below the \"\n        \"evidence threshold are flagged insufficient/marginal, not \"\n        \"recommended.\"\n    )\n    parameters = {\n        \"type\": \"object\",\n        \"properties\": {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/tools/strategy_discovery_tool.py#L105-L141","documentation":"strategy_discovery_tool._coerce_bool accepts booleans, and the strings \"true\"/\"1\"/\"yes\" and \"false\"/\"0\"/\"no\" (case-insensitive after strip). Everything else — numeric ints like 2, strings like \"on\"/\"off\", lists — falls through to the final raise, producing this ValueError.","triggerScenarios":"Passing \"on\", \"off\", \"maybe\", 2, -1, or [True] for a boolean parameter; e.g. execute(include_benchmarks=\"on\") fails because \"on\" is not in the accepted set.","commonSituations":"Shell/env-style flags (\"on\"/\"off\") flowing into tool calls; LLM emitting \"True \" with unusual casing works but \"y\"/\"enable\" does not; config files using 2/−1 as tri-state values.","solutions":["Pass a real Python bool, or one of the accepted strings: true/1/yes or false/0/no (any case)","Normalize your config values to booleans before calling the tool","If \"on\"/\"off\" must be supported upstream, map them yourself: {'on': True, 'off': False}"],"exampleFix":"# before\ntool.execute(include_benchmarks=\"on\")\n# after\ntool.execute(include_benchmarks=\"yes\")  # or True","handlingStrategy":"validation","validationCode":"BOOL_STRINGS = {\"true\": True, \"1\": True, \"yes\": True, \"false\": False, \"0\": False, \"no\": False}\nif isinstance(value, str):\n    value = BOOL_STRINGS.get(value.strip().lower(), value)\ntool.execute(**{name: value})","typeGuard":"def is_bool_coercible(v) -> bool:\n    if isinstance(v, bool):\n        return True\n    return isinstance(v, str) and v.strip().lower() in {\"true\",\"1\",\"yes\",\"false\",\"0\",\"no\"}","tryCatchPattern":null,"preventionTips":["Map env-style values (on/off) to booleans before calling","Stick to true/1/yes and false/0/no strings or real bools"],"tags":["strategy-discovery","boolean-coercion","string-args","validation"],"backgroundTag":"invalid-boolean-value","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}