{"record":{"id":"04553503c8ce1b5f","repo":"HKUDS/Vibe-Trading","slug":"terminal-value-wacc-rate-must-exceed-1-got-wac","errorCode":null,"errorMessage":"terminal_value: wacc_rate must exceed -1, got {wacc_rate!r}","messagePattern":"terminal_value: wacc_rate must exceed -1, got (.+?)","errorType":"validation","errorClass":"ValuationError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":767,"sourceCode":"            ``exit_multiple.value`` is not a finite number; if ``wacc_rate <= -1``;\n            if ``terminal_growth.value >= wacc_rate`` (the perpetuity terminal\n            value is negative or infinite there, not merely large); if\n            ``terminal_year_ebitda <= 0`` (an EV/EBITDA multiple is undefined);\n            if ``exit_multiple.value <= 0``; or if the exit terminal value\n            happens to equal ``-final_year_fcff`` exactly, which makes the\n            implied-growth reverse-solve's denominator zero.\n    \"\"\"\n    _require_assumption(terminal_growth, \"terminal_growth\", \"terminal_value\")\n    _require_assumption(exit_multiple, \"exit_multiple\", \"terminal_value\")\n\n    final_year_fcff = _require_finite(final_year_fcff, \"final_year_fcff\", \"terminal_value\")\n    terminal_year_ebitda = _require_finite(\n        terminal_year_ebitda, \"terminal_year_ebitda\", \"terminal_value\"\n    )\n    wacc_rate = _require_finite(wacc_rate, \"wacc_rate\", \"terminal_value\")\n\n    if wacc_rate <= -1.0:\n        raise ValuationError(\n            f\"terminal_value: wacc_rate must exceed -1, got {wacc_rate!r}\"\n        )\n    growth = _require_finite(terminal_growth.value, \"terminal_growth.value\", \"terminal_value\")\n    if growth >= wacc_rate:\n        raise ValuationError(\n            f\"terminal_value: terminal_growth ({growth!r}) must be strictly \"\n            f\"less than WACC ({wacc_rate!r}); at or above WACC the Gordon-growth \"\n            \"terminal value is negative or infinite, not merely a large number. \"\n            \"Lower the growth assumption or check the WACC build.\"\n        )\n    if terminal_year_ebitda <= 0.0:\n        raise ValuationError(\n            f\"terminal_value: terminal_year_ebitda must be positive to derive \"\n            f\"an implied EV/EBITDA multiple, got {terminal_year_ebitda!r}\"\n        )\n    multiple = _require_finite(exit_multiple.value, \"exit_multiple.value\", \"terminal_value\")\n    if multiple <= 0.0:\n        raise ValuationError(","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L749-L785","documentation":"terminal_value() requires wacc_rate > -1 so that (1 + wacc_rate) is strictly positive and the perpetuity discounting math is well-defined. Values at or below -1 make the compounding factor zero or negative.","triggerScenarios":"terminal_value(wacc_rate=-1.0, ...) or wacc_rate=-1.2; typically a WACC computed as a negative after unusual inputs (negative cost of debt, near-zero rates with large tax shields).","commonSituations":"Extreme/synthetic inputs in stress tests; sign or percent errors producing nonsensical WACC (e.g. -8 instead of 0.08 used directly).","solutions":["Check the WACC build: it should be a small positive fraction (e.g. 0.08, not -8 or 8)","Sanity-bound wacc_rate to a plausible range (0 < wacc < 0.5) before terminal_value","If negative WACC is genuinely modeled, this library does not support it — use a different terminal-value method"],"exampleFix":"# before\nterminal_value(..., wacc_rate=wacc_from_model)  # wacc_from_model = -1.5\n\n# after\nassert 0.0 < wacc_from_model < 0.5, f'implausible WACC {wacc_from_model}'\nterminal_value(..., wacc_rate=wacc_from_model)","handlingStrategy":"validation","validationCode":"assert wacc_rate > -1.0, f'wacc_rate must exceed -1, got {wacc_rate}'\nassert 0.0 < wacc_rate < 0.5, f'implausible WACC {wacc_rate}'  # stricter practical bound\nterminal_value(..., wacc_rate=wacc_rate)","typeGuard":"def is_plausible_discount_rate(r) -> TypeGuard[float]:\n    return isinstance(r, (int, float)) and math.isfinite(r) and r > -1.0","tryCatchPattern":"try:\n    terminal_value(...)\nexcept ValuationError as e:\n    if 'wacc_rate' in str(e):\n        raise ModelInputsError(str(e)) from e\n    raise","preventionTips":["Sanity-bound WACC to a plausible positive range before terminal value","Check for percent-vs-fraction and sign errors in the WACC build","Log the full WACC composition whenever it looks unusual"],"tags":["valuation","terminal-value","wacc","domain-error"],"backgroundTag":"invalid-discount-rate","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}