{"record":{"id":"e3bea411a0176cb5","repo":"HKUDS/Vibe-Trading","slug":"fcff-bridge-tax-rate-must-be-within-0-1-got","errorCode":null,"errorMessage":"fcff_bridge: tax_rate must be within [0, 1], got {tax_rate!r}","messagePattern":"fcff_bridge: tax_rate must be within \\[0, 1\\], got (.+?)","errorType":"validation","errorClass":"ValuationError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":606,"sourceCode":"    Args:\n        ebit: EBIT forecast, one entry per projection year, oldest first.\n        tax_rate: Marginal tax rate in ``[0, 1]``, applied to every year.\n        depreciation_amortization: D&A forecast, same length as ``ebit``.\n        capex: Capital expenditure forecast (positive = cash outflow), same\n            length as ``ebit``.\n        delta_nwc: Net-working-capital change forecast (positive = cash\n            outflow; see the module docstring), same length as ``ebit``.\n\n    Returns:\n        One :class:`FCFFYear` per projection year, in order.\n\n    Raises:\n        ValuationError: If ``tax_rate`` is outside ``[0, 1]``, if ``ebit`` is\n            empty, if the other three forecasts are not the same length as\n            ``ebit``, or if any forecast entry is not a finite number.\n    \"\"\"\n    if not 0.0 <= tax_rate <= 1.0:\n        raise ValuationError(f\"fcff_bridge: tax_rate must be within [0, 1], got {tax_rate!r}\")\n\n    ebit_list = list(ebit)\n    horizon = len(ebit_list)\n    if horizon == 0:\n        raise ValuationError(\n            \"fcff_bridge: ebit forecast is empty; at least one projection year \"\n            \"is required\"\n        )\n    forecasts = {\n        \"depreciation_amortization\": list(depreciation_amortization),\n        \"capex\": list(capex),\n        \"delta_nwc\": list(delta_nwc),\n    }\n    for name, values in forecasts.items():\n        if len(values) != horizon:\n            raise ValuationError(\n                f\"fcff_bridge: {name} has {len(values)} year(s), expected \"\n                f\"{horizon} to match ebit\"","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L588-L624","documentation":"fcff_bridge() validates tax_rate as a fraction in [0, 1] before building forecast years; percent values, negatives, or >1 are rejected with ValuationError.","triggerScenarios":"fcff_bridge(tax_rate=21, ebit=[...]) with percent instead of 0.21; negative effective tax rates from credit-heavy financials passed unclamped.","commonSituations":"Same percent-vs-fraction class of mistake as wacc; tax rates sourced from statements as integers.","solutions":["Convert percent to fraction: tax_rate/100","Clamp computed effective rates to [0,1] or decide policy for negative rates before calling","Centralize unit conversion for all rate inputs (tax, growth, discount) at the config layer"],"exampleFix":"# before\nfcff_bridge(tax_rate=21, ...)\n\n# after\nfcff_bridge(tax_rate=0.21, ...)","handlingStrategy":"validation","validationCode":"assert 0.0 <= tax_rate <= 1.0, 'tax_rate must be a fraction'\nfcff_bridge(tax_rate=tax_rate, ...)","typeGuard":"def is_fraction(x) -> TypeGuard[float]:\n    return isinstance(x, (int, float)) and 0.0 <= x <= 1.0","tryCatchPattern":"try:\n    fcff_bridge(...)\nexcept ValuationError as e:\n    if 'tax_rate' in str(e):\n        return fcff_bridge(tax_rate=tax_rate / 100, ...)\n    raise","preventionTips":["Single shared to_fraction() helper for all percent inputs","Centralize unit policy (rates as decimals) in project conventions","Clamp effective tax rates before use"],"tags":["valuation","fcff","percent-vs-fraction","range-validation"],"backgroundTag":"percent-instead-of-fraction","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}