HKUDS/Vibe-Trading · error · ValuationError

terminal_value: wacc_rate must exceed -1, got {wacc_rate!r}

Error message

terminal_value: wacc_rate must exceed -1, got {wacc_rate!r}

What it means

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.

Source

Thrown at agent/src/quantlib/valuation/dcf.py:767

            ``exit_multiple.value`` is not a finite number; if ``wacc_rate <= -1``;
            if ``terminal_growth.value >= wacc_rate`` (the perpetuity terminal
            value is negative or infinite there, not merely large); if
            ``terminal_year_ebitda <= 0`` (an EV/EBITDA multiple is undefined);
            if ``exit_multiple.value <= 0``; or if the exit terminal value
            happens to equal ``-final_year_fcff`` exactly, which makes the
            implied-growth reverse-solve's denominator zero.
    """
    _require_assumption(terminal_growth, "terminal_growth", "terminal_value")
    _require_assumption(exit_multiple, "exit_multiple", "terminal_value")

    final_year_fcff = _require_finite(final_year_fcff, "final_year_fcff", "terminal_value")
    terminal_year_ebitda = _require_finite(
        terminal_year_ebitda, "terminal_year_ebitda", "terminal_value"
    )
    wacc_rate = _require_finite(wacc_rate, "wacc_rate", "terminal_value")

    if wacc_rate <= -1.0:
        raise ValuationError(
            f"terminal_value: wacc_rate must exceed -1, got {wacc_rate!r}"
        )
    growth = _require_finite(terminal_growth.value, "terminal_growth.value", "terminal_value")
    if growth >= wacc_rate:
        raise ValuationError(
            f"terminal_value: terminal_growth ({growth!r}) must be strictly "
            f"less than WACC ({wacc_rate!r}); at or above WACC the Gordon-growth "
            "terminal value is negative or infinite, not merely a large number. "
            "Lower the growth assumption or check the WACC build."
        )
    if terminal_year_ebitda <= 0.0:
        raise ValuationError(
            f"terminal_value: terminal_year_ebitda must be positive to derive "
            f"an implied EV/EBITDA multiple, got {terminal_year_ebitda!r}"
        )
    multiple = _require_finite(exit_multiple.value, "exit_multiple.value", "terminal_value")
    if multiple <= 0.0:
        raise ValuationError(

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Check the WACC build: it should be a small positive fraction (e.g. 0.08, not -8 or 8)
  2. Sanity-bound wacc_rate to a plausible range (0 < wacc < 0.5) before terminal_value
  3. If negative WACC is genuinely modeled, this library does not support it — use a different terminal-value method

Example fix

# before
terminal_value(..., wacc_rate=wacc_from_model)  # wacc_from_model = -1.5

# after
assert 0.0 < wacc_from_model < 0.5, f'implausible WACC {wacc_from_model}'
terminal_value(..., wacc_rate=wacc_from_model)
Defensive patterns

Strategy: validation

Validate before calling

assert wacc_rate > -1.0, f'wacc_rate must exceed -1, got {wacc_rate}'
assert 0.0 < wacc_rate < 0.5, f'implausible WACC {wacc_rate}'  # stricter practical bound
terminal_value(..., wacc_rate=wacc_rate)

Type guard

def is_plausible_discount_rate(r) -> TypeGuard[float]:
    return isinstance(r, (int, float)) and math.isfinite(r) and r > -1.0

Try / catch

try:
    terminal_value(...)
except ValuationError as e:
    if 'wacc_rate' in str(e):
        raise ModelInputsError(str(e)) from e
    raise

Prevention

When it happens

Trigger: 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).

Common situations: Extreme/synthetic inputs in stress tests; sign or percent errors producing nonsensical WACC (e.g. -8 instead of 0.08 used directly).

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/04553503c8ce1b5f. Report an issue: GitHub.