HKUDS/Vibe-Trading · error · ValueError
scenario_iv_values must contain positive finite values
Error message
scenario_iv_values must contain positive finite values
What it means
After numeric coercion succeeds, _scenario_ivs converts the list to a numpy float array and requires all values finite and strictly positive (IVs are sqrt-of-time multipliers, so zero/negative/NaN/inf vol is mathematically invalid). Failing np.isfinite().all() or (array <= 0).any() raises this error.
Source
Thrown at agent/src/tools/options_payoff_tool.py:338
values = [
entry_iv * 0.5,
entry_iv * 0.75,
entry_iv,
entry_iv * 1.25,
entry_iv * 1.5,
]
else:
if not isinstance(raw, list) or not raw:
raise ValueError("scenario_iv_values must be a non-empty array")
if len(raw) > _MAX_IV_SCENARIOS:
raise ValueError(f"scenario_iv_values may contain at most {_MAX_IV_SCENARIOS} entries")
try:
values = [float(value) for value in raw]
except (TypeError, ValueError, OverflowError) as exc:
raise ValueError("scenario_iv_values must contain numbers") from exc
array = np.asarray(values, dtype=float)
if not np.isfinite(array).all() or (array <= 0).any():
raise ValueError("scenario_iv_values must contain positive finite values")
return array
def _rounded(value: float) -> float:
"""Round a finite scalar for stable, compact JSON."""
return round(float(value), 6)
def _rounded_array(values: np.ndarray) -> list[float]:
"""Round a numeric array for stable, compact JSON."""
return [round(float(value), 6) for value in np.asarray(values).tolist()]
def _error(message: str) -> str:
"""Build a stable error envelope."""
return json.dumps(
{"status": "error", "tool": "options_payoff", "error": message},
ensure_ascii=False,View on GitHub (pinned to 80ffdda44c)
Solutions
- Use strictly positive decimal volatilities like [0.15, 0.20, 0.30]
- Guard computed IVs with math.isfinite(v) and v > 0 before calling
- Check for accidental 0 default values in configuration
Example fix
// before scenario_iv_values=[0, 0.2] // after scenario_iv_values=[0.01, 0.2]
Defensive patterns
Strategy: validation
Validate before calling
import math ivs = [float(v) for v in ivs] assert all(math.isfinite(v) and v > 0 for v in ivs), "IVs must be positive finite"
Type guard
def valid_ivs(v: object) -> bool:
return isinstance(v, list) and bool(v) and all(
isinstance(x, (int, float)) and math.isfinite(x) and x > 0 for x in v
) Try / catch
try:
tool.execute(**kwargs)
except ValueError as e:
if "positive finite" in str(e):
ivs = [max(v, 1e-4) for v in ivs] # floor tiny/zero vols Prevention
- Never mix percent and decimal conventions
- Floor computed vols at a small epsilon
- Assert finiteness after any upstream arithmetic
When it happens
Trigger: scenario_iv_values containing 0, a negative number, NaN, or inf (e.g. [0.0, 0.2], [-0.2], [float('nan')]).
Common situations: Passing volatilities as percentages mixed with decimals, defaults of 0 leaking from config, or arithmetic upstream producing NaN/inf.
Related errors
- scenario_iv_values must contain numbers
- delay requires n >= 1 (lookahead ban)
- delay requires n >= 1 (lookahead ban)
- delay requires n >= 1 (lookahead ban)
- delay requires n >= 1 (lookahead ban)
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/48d28b4ce9f2de12.
Report an issue: GitHub.