{"record":{"id":"c4be66b324081fdb","repo":"HKUDS/Vibe-Trading","slug":"terminalvalueresult-terminal-growth-value-self-te","errorCode":null,"errorMessage":"TerminalValueResult.terminal_growth.value={self.terminal_growth.value!r} is not below wacc_rate={self.wacc_rate!r}","messagePattern":"TerminalValueResult\\.terminal_growth\\.value=(.+?) is not below wacc_rate=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":711,"sourceCode":"    perpetuity_terminal_value: float\n    terminal_year_ebitda: float\n    exit_multiple: Assumption\n    exit_terminal_value: float\n    implied_ev_ebitda_multiple: float\n    implied_perpetuity_growth: float\n    gdp_growth_ceiling: float\n    growth_exceeds_gdp_ceiling: bool\n\n    def __post_init__(self) -> None:\n        \"\"\"Re-check that the stored growth rate is still below WACC.\n\n        Raises:\n            ValueError: If ``terminal_growth.value >= wacc_rate``. This should\n                already have been refused by :func:`terminal_value` before\n                construction; this is a second, independent check.\n        \"\"\"\n        if float(self.terminal_growth.value) >= self.wacc_rate:\n            raise ValueError(\n                f\"TerminalValueResult.terminal_growth.value=\"\n                f\"{self.terminal_growth.value!r} is not below wacc_rate=\"\n                f\"{self.wacc_rate!r}\"\n            )\n\n\ndef terminal_value(\n    *,\n    final_year_fcff: float,\n    terminal_year_ebitda: float,\n    wacc_rate: float,\n    terminal_growth: Assumption,\n    exit_multiple: Assumption,\n    gdp_growth_ceiling: float = DEFAULT_LONG_RUN_GDP_GROWTH_CEILING,\n) -> TerminalValueResult:\n    \"\"\"Compute both terminal-value estimates and cross-validate them.\n\n    Args:","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L693-L729","documentation":"TerminalValueResult.__post_init__ independently re-checks that terminal_growth.value < wacc_rate, guarding the Gordon-growth denominator. terminal_value() should have refused such inputs first; this is a second line of defense against inconsistent construction.","triggerScenarios":"Manually constructing TerminalValueResult(terminal_growth=Rate(0.08), wacc_rate=0.07, ...); or mutating a result and revalidizing. If reached via terminal_value(), it indicates a validation-order bug in the library.","commonSituations":"Tests or adapters building the result object directly; library version skew between the guard in terminal_value() and this invariant.","solutions":["Construct results via terminal_value(), not the dataclass","Ensure growth < wacc before building (lower growth or raise WACC inputs)","If hit via the public path, report it as a library bug with both values"],"exampleFix":"# before\nTerminalValueResult(terminal_growth=Rate(0.08), wacc_rate=0.07, ...)\n\n# after\nterminal_value(terminal_year_ebitda=ebitda, wacc_rate=0.07, terminal_growth=Rate(0.05), ...)","handlingStrategy":"validation","validationCode":"assert terminal_growth.value < wacc_rate, 'g must be < wacc'\nresult = terminal_value(...)  # not the dataclass directly","typeGuard":"def growth_below_wacc(g: float, w: float) -> bool:\n    return g < w","tryCatchPattern":"try:\n    TerminalValueResult(...)\nexcept ValueError as e:\n    raise AssertionError(f'do not construct directly; use terminal_value(): {e}') from e","preventionTips":["Always build via terminal_value()","Enforce g < wacc in your own pipeline before any terminal-value math","Report library bugs if the invariant fires on the public path"],"tags":["valuation","terminal-value","gordon-growth","dataclass-invariants"],"backgroundTag":"growth-at-or-above-discount-rate","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}