HKUDS/Vibe-Trading · error · ValueError
{name} must be a boolean, got {value!r}
Error message
{name} must be a boolean, got {value!r} What it means
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.
Source
Thrown at agent/src/tools/strategy_discovery_tool.py:123
f"max {_MAX_STRING_PARAM_CHARS})"
)
text = value.strip()
return text or None
def _coerce_bool(value: Any, name: str, default: bool) -> bool:
"""Coerce a boolean parameter, tolerating common LLM string forms."""
if value is None:
return default
if isinstance(value, bool):
return value
if isinstance(value, str):
lowered = value.strip().lower()
if lowered in {"true", "1", "yes"}:
return True
if lowered in {"false", "0", "no"}:
return False
raise ValueError(f"{name} must be a boolean, got {value!r}")
class ListStrategiesTool(BaseTool):
"""List discoverable strategies from Alpha Zoo and the SDM store."""
name = "list_strategies"
description = (
"List discoverable strategies across the Alpha Zoo registry and the "
"SDM strategy store. Read-only catalogue of what strategies exist "
"(identification metadata only). Rows carry evidence status; use "
"get_strategy_evidence for the per-regime evidence behind any "
"strategy. Nothing here is a recommendation — rows below the "
"evidence threshold are flagged insufficient/marginal, not "
"recommended."
)
parameters = {
"type": "object",
"properties": {View on GitHub (pinned to 80ffdda44c)
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}
Example fix
# before tool.execute(include_benchmarks="on") # after tool.execute(include_benchmarks="yes") # or True
Defensive patterns
Strategy: validation
Validate before calling
BOOL_STRINGS = {"true": True, "1": True, "yes": True, "false": False, "0": False, "no": False}
if isinstance(value, str):
value = BOOL_STRINGS.get(value.strip().lower(), value)
tool.execute(**{name: value}) Type guard
def is_bool_coercible(v) -> bool:
if isinstance(v, bool):
return True
return isinstance(v, str) and v.strip().lower() in {"true","1","yes","false","0","no"} Prevention
- Map env-style values (on/off) to booleans before calling
- Stick to true/1/yes and false/0/no strings or real bools
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {name} must be a string, got {value!r}
- {name} is too long ({len(value)} chars; max {_MAX_STRING_PAR
- {name} must be an integer, got {value!r}
- {name} must be a number, got {value!r}
- provide exactly one of manifest_path or runs, not both
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/f6de5632f0420da8.
Report an issue: GitHub.