{"record":{"id":"a44d0dbfd7610c76","repo":"HKUDS/Vibe-Trading","slug":"run-dcf-discounting-convention-must-be-one-of-di","errorCode":null,"errorMessage":"run_dcf: discounting_convention must be one of {DISCOUNTING_CONVENTIONS}, got {discounting_convention!r}","messagePattern":"run_dcf: discounting_convention must be one of (.+?), got (.+?)","errorType":"validation","errorClass":"ValuationError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":1317,"sourceCode":"        A :class:`DCFResult` with every intermediate figure visible.\n\n    Raises:\n        MissingInputError: If any required key is absent from ``inputs``.\n        ValuationError: If ``capital_structure_basis``,\n            ``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\")","sourceCodeStart":1299,"sourceCodeEnd":1335,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L1299-L1335","documentation":"run_dcf requires discounting_convention to be one of DISCOUNTING_CONVENTIONS (e.g. mid-year vs full-year discounting conventions). Passing any other string raises ValuationError before projections are built, because the convention controls how discount factors are computed for every period.","triggerScenarios":"Calling run_dcf with discounting_convention set to a string not in DISCOUNTING_CONVENTIONS — typo like 'mid_year' instead of the canonical 'mid-year', or passing a capital_structure_basis value by mistake.","commonSituations":"Hand-written config files with hyphen/underscore mismatches; swapping two enum arguments positionally; version upgrades that renamed conventions.","solutions":["Import DISCOUNTING_CONVENTIONS and use an exact member.","Fix hyphen/underscore or casing mismatch in the config value.","Add a schema check on your config dict that whitelists both enum fields before calling run_dcf."],"exampleFix":"// before\nrun_dcf(..., discounting_convention=\"mid_year\")\n// after\nrun_dcf(..., discounting_convention=\"mid-year\")  # exact member of DISCOUNTING_CONVENTIONS","handlingStrategy":"validation","validationCode":"from quantlib.valuation.dcf import DISCOUNTING_CONVENTIONS\nassert discounting_convention in DISCOUNTING_CONVENTIONS","typeGuard":"def is_valid_convention(c: str) -> bool:\n    from quantlib.valuation.dcf import DISCOUNTING_CONVENTIONS\n    return isinstance(c, str) and c in DISCOUNTING_CONVENTIONS","tryCatchPattern":"except ValuationError as e:\n    if 'discounting_convention' in str(e): raise ConfigError(str(e)) from e","preventionTips":["Use keyword arguments for enum-like parameters","Normalize config strings (strip/lower) against the module constant sets"],"tags":["valuation","dcf","enum-validation","discounting"],"backgroundTag":"enum-value-invalid","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}