HKUDS/Vibe-Trading · error · ValuationError
terminal_value: terminal_growth ({growth!r}) must be strictl
Error message
terminal_value: terminal_growth ({growth!r}) must be strictly 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. What it means
terminal_value() refuses terminal growth >= WACC: with g at or above the discount rate the Gordon-growth TV = EBITDA*(1+g)/(wacc-g) is negative or infinite, so the library rejects the assumption rather than emitting a meaningless huge number.
Source
Thrown at agent/src/quantlib/valuation/dcf.py:772
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(
f"terminal_value: exit_multiple.value must be positive, got {multiple!r}"
)
next_year_fcff = final_year_fcff * (1.0 + growth)
perpetuity_tv = next_year_fcff / (wacc_rate - growth)View on GitHub (pinned to 80ffdda44c)
Solutions
- Lower terminal growth to below WACC (commonly 2-2.5% cap) or revisit the WACC build upward
- Check for unit mismatch: both must be decimals (0.07 vs 0.03, not 7 vs 0.03)
- Add a pre-flight assertion g < wacc - margin in the modeling pipeline
Example fix
# before terminal_value(..., wacc_rate=0.065, terminal_growth=Rate(0.07)) # after terminal_value(..., wacc_rate=0.09, terminal_growth=Rate(0.025))
Defensive patterns
Strategy: validation
Validate before calling
MARGIN = 0.005
assert terminal_growth.value < wacc_rate - MARGIN, f'g={terminal_growth.value} must be below wacc={wacc_rate} - {MARGIN}'
terminal_value(..., terminal_growth=terminal_growth, wacc_rate=wacc_rate) Type guard
def growth_safe_for_gordon(g: float, wacc: float, margin: float = 0.005) -> bool:
return g < wacc - margin Try / catch
try:
terminal_value(...)
except ValuationError as e:
if 'strictly less than WACC' in str(e):
return terminal_value(..., terminal_growth=Rate(min(g, wacc - 0.005)), wacc_rate=wacc)
raise Prevention
- Cap perpetuity growth at ~2-2.5% or below WACC minus a margin
- Re-run the WACC build when rate assumptions change materially
- Verify both g and wacc are decimals, never percents
When it happens
Trigger: terminal_value(wacc_rate=0.07, terminal_growth=Rate(0.07)) or growth 0.09 vs wacc 0.07; WACC computed too low relative to a growth assumption of 2-3%.
Common situations: Optimistic perpetuity growth (3%) with a low WACC from a low beta/rate environment; unit mismatch (wacc as 7 vs growth 0.03); widening spreads where the WACC estimate drops below long-run nominal growth.
Related errors
- TerminalValueResult.terminal_growth.value={self.terminal_gro
- terminal_value: wacc_rate must exceed -1, got {wacc_rate!r}
- run_dcf: terminal_value_method must be one of {TERMINAL_VALU
- latest valuation on {marks[-1].date} is {value!r}; a residua
- valuations[{index}] must be a (date, value) pair, got {type(
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/75160c6dca55a1fd.
Report an issue: GitHub.