{"record":{"id":"7f7a381c3e5b45df","repo":"HKUDS/Vibe-Trading","slug":"run-dcf-terminal-value-method-must-be-one-of-ter","errorCode":null,"errorMessage":"run_dcf: terminal_value_method must be one of {TERMINAL_VALUE_METHODS}, got {terminal_value_method!r}","messagePattern":"run_dcf: terminal_value_method must be one of (.+?), got (.+?)","errorType":"validation","errorClass":"ValuationError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":1322,"sourceCode":"            ``discounting_convention`` or ``terminal_value_method`` is\n            unrecognised; if ``terminal_growth`` or ``exit_multiple`` is not\n            the matching :class:`Assumption`; if ``terminal_growth.value >=``\n            the built WACC; if any capital-structure, FCFF-bridge or\n            balance-sheet input fails its own guard (see :func:`wacc`,\n            :func:`fcff_bridge`, :func:`terminal_value`, :func:`equity_bridge`).\n    \"\"\"\n    if capital_structure_basis not in CAPITAL_STRUCTURE_BASES:\n        raise ValuationError(\n            f\"run_dcf: capital_structure_basis must be one of \"\n            f\"{CAPITAL_STRUCTURE_BASES}, got {capital_structure_basis!r}\"\n        )\n    if discounting_convention not in DISCOUNTING_CONVENTIONS:\n        raise ValuationError(\n            f\"run_dcf: discounting_convention must be one of \"\n            f\"{DISCOUNTING_CONVENTIONS}, got {discounting_convention!r}\"\n        )\n    if terminal_value_method not in TERMINAL_VALUE_METHODS:\n        raise ValuationError(\n            f\"run_dcf: terminal_value_method must be one of \"\n            f\"{TERMINAL_VALUE_METHODS}, got {terminal_value_method!r}\"\n        )\n\n    structure_fields = (\n        DCF_CURRENT_STRUCTURE_FIELDS\n        if capital_structure_basis == \"current\"\n        else DCF_TARGET_STRUCTURE_FIELDS\n    )\n    require_inputs(inputs, (*DCF_BASE_REQUIRED_FIELDS, *structure_fields), model=\"run_dcf\")\n\n    terminal_growth = _require_assumption(inputs[\"terminal_growth\"], \"terminal_growth\", \"run_dcf\")\n    exit_multiple = _require_assumption(inputs[\"exit_multiple\"], \"exit_multiple\", \"run_dcf\")\n\n    wacc_build = wacc(\n        risk_free_rate=inputs[\"risk_free_rate\"],\n        beta=inputs[\"beta\"],\n        equity_risk_premium=inputs[\"equity_risk_premium\"],","sourceCodeStart":1304,"sourceCodeEnd":1340,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L1304-L1340","documentation":"run_dcf only accepts terminal_value_method values from TERMINAL_VALUE_METHODS (typically 'perpetuity_growth' and 'exit_multiple'). An unrecognized method name raises ValuationError up front, since the terminal value dominates the DCF result and an unknown formula would silently produce garbage.","triggerScenarios":"Calling run_dcf(terminal_value_method=...) with a string not in TERMINAL_VALUE_METHODS, e.g. 'exit-multiple' with a hyphen, 'GordonGrowth', or an entirely made-up method.","commonSituations":"Users porting terminology from other models (Excel templates, other libraries) that name terminal-value methods differently; LLM-generated kwargs with guessed enum strings.","solutions":["Import TERMINAL_VALUE_METHODS and pass an exact member.","Correct spelling/separator style to match the module constants.","Whitelist terminal_value_method in config validation before run_dcf."],"exampleFix":"// before\nrun_dcf(..., terminal_value_method=\"exit-multiple\")\n// after\nrun_dcf(..., terminal_value_method=\"exit_multiple\")","handlingStrategy":"validation","validationCode":"from quantlib.valuation.dcf import TERMINAL_VALUE_METHODS\nassert terminal_value_method in TERMINAL_VALUE_METHODS","typeGuard":"def is_valid_tv_method(m: str) -> bool:\n    from quantlib.valuation.dcf import TERMINAL_VALUE_METHODS\n    return isinstance(m, str) and m in TERMINAL_VALUE_METHODS","tryCatchPattern":"except ValuationError as e:\n    if 'terminal_value_method' in str(e): fix_and_retry(e)","preventionTips":["Document allowed enum values next to config schemas","Fail fast in config parsers on unknown keys"],"tags":["valuation","dcf","enum-validation","terminal-value"],"backgroundTag":"enum-value-invalid","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}