HKUDS/Vibe-Trading · error · MissingInputError
wacc
Error message
wacc
What it means
A MissingInputError (message context 'wacc') raised when capital_structure_basis='current' but market_value_of_equity or market_value_of_debt is None. The library refuses to substitute a default for a structurally required input.
Source
Thrown at agent/src/quantlib/valuation/dcf.py:449
if capital_structure_basis not in CAPITAL_STRUCTURE_BASES:
raise ValuationError(
f"wacc: capital_structure_basis must be one of "
f"{CAPITAL_STRUCTURE_BASES}, got {capital_structure_basis!r}"
)
if not 0.0 <= tax_rate <= 1.0:
raise ValuationError(f"wacc: tax_rate must be within [0, 1], got {tax_rate!r}")
if capital_structure_basis == "current":
missing = [
name
for name, value in (
("market_value_of_equity", market_value_of_equity),
("market_value_of_debt", market_value_of_debt),
)
if value is None
]
if missing:
raise MissingInputError(missing, "wacc")
equity_mv = _require_nonnegative(
market_value_of_equity, "market_value_of_equity", "wacc"
)
debt_mv = _require_nonnegative(
market_value_of_debt, "market_value_of_debt", "wacc"
)
total_mv = equity_mv + debt_mv
if total_mv <= 0.0:
raise ValuationError(
"wacc: market value of equity plus debt is zero (D + E = 0); "
"capital-structure weights are undefined"
)
equity_weight = equity_mv / total_mv
debt_weight = debt_mv / total_mv
else:
missing = [
name
for name, value in (View on GitHub (pinned to 80ffdda44c)
Solutions
- Supply both market_value_of_equity and market_value_of_debt, or switch to capital_structure_basis='target' with target weights
- Treat MissingInputError as a data-completeness signal: fetch/repair the missing field for that ticker
- Pre-check inputs for None before calling and route to a fallback path
Example fix
# before wacc(..., capital_structure_basis='current', market_value_of_debt=None) # after wacc(..., capital_structure_basis='current', market_value_of_debt=total_debt_mv)
Defensive patterns
Strategy: validation
Validate before calling
missing = [n for n, v in {'market_value_of_equity': e_mv, 'market_value_of_debt': d_mv}.items() if v is None]
if missing:
raise ValueError(f'missing market data: {missing}')
wacc(..., market_value_of_equity=e_mv, market_value_of_debt=d_mv) Type guard
def has_current_inputs(e_mv, d_mv) -> bool:
return e_mv is not None and d_mv is not None Try / catch
try:
wacc(...)
except MissingInputError as e:
mark_ticker_incomplete(ticker, e.fields)
continue Prevention
- Check None for both market values before choosing 'current' basis
- Fall back to 'target' basis when market data is unavailable
- Treat MissingInputError as a data-completeness signal, not a crash
When it happens
Trigger: wacc(capital_structure_basis='current') with either market value omitted/None, e.g. when debt data is unavailable for an all-equity screen.
Common situations: Data pipelines where one side of the capital structure is missing for some tickers; forgetting to switch basis to 'target' when using target weights.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- {model}: name is required and cannot be blank, got {name!r}
- peers
- an assumption must be named
- MissingInputError(missing, model)
- {model}: {name} must be a number, got {value!r}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/72d29e910953603f.
Report an issue: GitHub.