{"record":{"id":"72d29e910953603f","repo":"HKUDS/Vibe-Trading","slug":"wacc","errorCode":null,"errorMessage":"wacc","messagePattern":"wacc","errorType":"validation","errorClass":"MissingInputError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":449,"sourceCode":"    if capital_structure_basis not in CAPITAL_STRUCTURE_BASES:\n        raise ValuationError(\n            f\"wacc: capital_structure_basis must be one of \"\n            f\"{CAPITAL_STRUCTURE_BASES}, got {capital_structure_basis!r}\"\n        )\n    if not 0.0 <= tax_rate <= 1.0:\n        raise ValuationError(f\"wacc: tax_rate must be within [0, 1], got {tax_rate!r}\")\n\n    if capital_structure_basis == \"current\":\n        missing = [\n            name\n            for name, value in (\n                (\"market_value_of_equity\", market_value_of_equity),\n                (\"market_value_of_debt\", market_value_of_debt),\n            )\n            if value is None\n        ]\n        if missing:\n            raise MissingInputError(missing, \"wacc\")\n        equity_mv = _require_nonnegative(\n            market_value_of_equity, \"market_value_of_equity\", \"wacc\"\n        )\n        debt_mv = _require_nonnegative(\n            market_value_of_debt, \"market_value_of_debt\", \"wacc\"\n        )\n        total_mv = equity_mv + debt_mv\n        if total_mv <= 0.0:\n            raise ValuationError(\n                \"wacc: market value of equity plus debt is zero (D + E = 0); \"\n                \"capital-structure weights are undefined\"\n            )\n        equity_weight = equity_mv / total_mv\n        debt_weight = debt_mv / total_mv\n    else:\n        missing = [\n            name\n            for name, value in (","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L431-L467","documentation":"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.","triggerScenarios":"wacc(capital_structure_basis='current') with either market value omitted/None, e.g. when debt data is unavailable for an all-equity screen.","commonSituations":"Data pipelines where one side of the capital structure is missing for some tickers; forgetting to switch basis to 'target' when using target weights.","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"],"exampleFix":"# before\nwacc(..., capital_structure_basis='current', market_value_of_debt=None)\n\n# after\nwacc(..., capital_structure_basis='current', market_value_of_debt=total_debt_mv)","handlingStrategy":"validation","validationCode":"missing = [n for n, v in {'market_value_of_equity': e_mv, 'market_value_of_debt': d_mv}.items() if v is None]\nif missing:\n    raise ValueError(f'missing market data: {missing}')\nwacc(..., market_value_of_equity=e_mv, market_value_of_debt=d_mv)","typeGuard":"def has_current_inputs(e_mv, d_mv) -> bool:\n    return e_mv is not None and d_mv is not None","tryCatchPattern":"try:\n    wacc(...)\nexcept MissingInputError as e:\n    mark_ticker_incomplete(ticker, e.fields)\n    continue","preventionTips":["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"],"tags":["valuation","wacc","missing-input","required-field"],"backgroundTag":"missing-required-field","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}