HKUDS/Vibe-Trading · error · ValueError
spot is required
Error message
spot is required
What it means
The options pricing tool's execute requires four mandatory arguments; spot is checked first. If the kwargs dict lacks 'spot' or its value is JSON null, ValueError('spot is required') is raised inside a try block that converts it to an error envelope for the caller.
Source
Thrown at agent/src/tools/options_pricing_tool.py:110
"required": ["spot", "strike", "expiry_days", "volatility", "option_type"],
}
def execute(self, **kwargs: Any) -> str:
"""Run options pricing calculation.
Args:
**kwargs: Must include spot, strike, expiry_days, volatility, option_type.
Optional risk_free_rate.
Returns:
JSON string containing price, delta, gamma, theta, vega, or an error
envelope when an argument is missing or cannot be read as a number.
``risk_free_rate`` is optional and defaults to its schema value 0.05,
so an explicit JSON ``null`` is treated as omission.
"""
try:
if "spot" not in kwargs or kwargs["spot"] is None:
raise ValueError("spot is required")
if "strike" not in kwargs or kwargs["strike"] is None:
raise ValueError("strike is required")
if "expiry_days" not in kwargs or kwargs["expiry_days"] is None:
raise ValueError("expiry_days is required")
if "volatility" not in kwargs or kwargs["volatility"] is None:
raise ValueError("volatility is required")
spot = float(kwargs["spot"])
strike = float(kwargs["strike"])
expiry_days = float(kwargs["expiry_days"])
r_val = kwargs.get("risk_free_rate")
r = float(r_val if r_val is not None and r_val != "" else 0.05)
sigma = float(kwargs["volatility"])
option_type = str(kwargs.get("option_type") or "")
except (TypeError, ValueError, KeyError, OverflowError) as exc:
# OverflowError: a JSON integer larger than a float (e.g. 10**10000)
# raises it from float(), and it must not escape this envelope.
return json.dumps(
{"status": "error", "tool": "options_pricing", "error": f"invalid or missing input argument: {exc}"},View on GitHub (pinned to 80ffdda44c)
Solutions
- Always pass a positive numeric spot, e.g. spot: 100.0
- Check kwargs before calling: if not kwargs.get('spot'): ...
- Don't send null for required fields; only risk_free_rate treats null as omission
Example fix
// before tool.execute(strike=100, expiry_days=30, volatility=0.2) // after tool.execute(spot=100.0, strike=100, expiry_days=30, volatility=0.2)
Defensive patterns
Strategy: validation
Validate before calling
required = ("spot", "strike", "expiry_days", "volatility")
missing = [k for k in required if kwargs.get(k) is None]
if missing:
raise ArgumentError(f"missing: {missing}") Type guard
def has_required_pricing_args(kw: dict) -> bool:
return all(kw.get(k) is not None for k in ("spot", "strike", "expiry_days", "volatility")) Try / catch
try:
out = tool.execute(**kwargs)
except ValueError as e:
if "spot is required" in str(e):
return error_envelope("Please supply the current spot price.") Prevention
- Build kwargs from a fixed template with all four fields
- Treat only risk_free_rate as optional
- Validate before dispatch, not after
When it happens
Trigger: Calling execute without a spot key, or with spot: null in the JSON payload. All other missing-arg errors are shadowed by this one since spot is validated first.
Common situations: LLM tool calls omitting a required field, upstream code conditionally building kwargs and skipping spot, or explicit nulls used to 'reset' defaults.
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
- strike is required
- expiry_days is required
- volatility is required
- run_card_path or backtest_run_dir is required
- job_id is required for propose_cancel
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/ac412ea9ba3d5ea8.
Report an issue: GitHub.