HKUDS/Vibe-Trading · error · ValueError
{name} is required
Error message
{name} is required What it means
Thrown by _required_float when a mandatory numeric kwarg (e.g. entry_spot, entry_iv) is absent, null, or empty string. These parameters anchor all payoff/greeks math so the tool refuses to default them.
Source
Thrown at agent/src/tools/options_payoff_tool.py:261
qty_number = float(raw_qty)
except (KeyError, TypeError, ValueError, OverflowError) as exc:
raise ValueError(f"legs[{index}] has invalid strike or qty: {exc}") from exc
if isinstance(raw_qty, bool) or not qty_number.is_integer():
raise ValueError(f"legs[{index}].qty must be a non-zero integer")
qty = int(qty_number)
raw_premium = item.get("premium")
try:
premium = None if raw_premium is None else float(raw_premium)
except (TypeError, ValueError, OverflowError) as exc:
raise ValueError(f"legs[{index}].premium must be numeric or null") from exc
legs.append(OptionLeg(option_type, strike, qty, premium))
return legs
def _required_float(kwargs: dict[str, Any], name: str) -> float:
"""Read a required finite float."""
if name not in kwargs or kwargs[name] is None or kwargs[name] == "":
raise ValueError(f"{name} is required")
try:
value = float(kwargs[name])
except (TypeError, ValueError, OverflowError) as exc:
raise ValueError(f"{name} must be numeric") from exc
if not math.isfinite(value):
raise ValueError(f"{name} must be finite")
return value
def _optional_float(kwargs: dict[str, Any], name: str, default: float) -> float:
"""Read an optional finite float, treating null and empty text as omitted."""
raw = kwargs.get(name)
if raw is None or raw == "":
return default
try:
value = float(raw)
except (TypeError, ValueError, OverflowError) as exc:
raise ValueError(f"{name} must be numeric") from excView on GitHub (pinned to 80ffdda44c)
Solutions
- Supply the required parameter with a numeric value (check the tool's arg spec for which names _required_float guards)
- Fix key names/casing to exactly match the tool schema
- If the value is genuinely unknown, have the caller compute/fetch it before invoking
Example fix
// before
execute({"legs": legs}) # missing entry_spot
// after
execute({"legs": legs, "entry_spot": 100.0}) Defensive patterns
Strategy: validation
Validate before calling
REQUIRED = ("entry_spot", "entry_iv") # per tool spec
missing = [k for k in REQUIRED if kwargs.get(k) in (None, "")]
if missing:
raise ValueError(f"missing required params: {missing}") Type guard
def has_required_numeric_kwargs(kwargs: dict, names: tuple) -> bool:
return all(kwargs.get(n) not in (None, "") for n in names) Try / catch
try:
execute(kwargs)
except ValueError as e:
if "is required" in str(e):
prompt_user_for(str(e).split()[0]) Prevention
- Generate calls from the tool's declared schema
- Mark required fields as such in LLM function definitions
- Prefill required params from context before dispatch
When it happens
Trigger: Calling execute without entry_spot; passing entry_spot=None or ""; kwargs keys with different casing (entrySpot) so the expected key is effectively missing.
Common situations: LLM tool calls omitting required params; clients forwarding optional-only forms; schema drift between caller and tool versions renaming parameters.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- title is required
- thesis is required
- memory name must not be empty or whitespace-only
- T must be > 0 to imply a volatility, got {T}
- {model}: name is required and cannot be blank, got {name!r}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/0358fb64e311195d.
Report an issue: GitHub.