{"record":{"id":"d5f26b7e02f49acf","repo":"HKUDS/Vibe-Trading","slug":"fcffyear-year-self-year-fcff-self-fcff-r-does","errorCode":null,"errorMessage":"FCFFYear(year={self.year}).fcff={self.fcff!r} does not match the bridge total {expected_fcff!r}","messagePattern":"FCFFYear\\(year=(.+?)\\)\\.fcff=(.+?) does not match the bridge total (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/dcf.py","lineNumber":572,"sourceCode":"                or ``year`` is not a positive integer.\n        \"\"\"\n        if self.year < 1:\n            raise ValueError(f\"FCFFYear.year must be >= 1, got {self.year!r}\")\n        expected_nopat = self.ebit * (1.0 - self.tax_rate)\n        if not math.isclose(\n            self.nopat, expected_nopat, rel_tol=_RECONCILIATION_TOLERANCE, abs_tol=1e-9\n        ):\n            raise ValueError(\n                f\"FCFFYear(year={self.year}).nopat={self.nopat!r} does not match \"\n                f\"ebit * (1 - tax_rate) = {expected_nopat!r}\"\n            )\n        expected_fcff = (\n            self.nopat + self.depreciation_amortization - self.capex - self.delta_nwc\n        )\n        if not math.isclose(\n            self.fcff, expected_fcff, rel_tol=_RECONCILIATION_TOLERANCE, abs_tol=1e-9\n        ):\n            raise ValueError(\n                f\"FCFFYear(year={self.year}).fcff={self.fcff!r} does not match the \"\n                f\"bridge total {expected_fcff!r}\"\n            )\n\n\ndef fcff_bridge(\n    *,\n    ebit: Sequence[float],\n    tax_rate: float,\n    depreciation_amortization: Sequence[float],\n    capex: Sequence[float],\n    delta_nwc: Sequence[float],\n) -> tuple[FCFFYear, ...]:\n    \"\"\"Build the EBIT -> FCFF bridge for every projection year.\n\n    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.","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/dcf.py#L554-L590","documentation":"FCFFYear.__post_init__ verifies fcff = nopat + D&A - capex - delta_nwc within tolerance and raises ValueError on mismatch. Ensures the stored fcff is exactly the bridge total, not an independently sourced number.","triggerScenarios":"Passing a fcff value from a broker template whose bridge differs (e.g. different sign convention for delta_nwc), or rounding fcff independently of the components.","commonSituations":"Spreadsheet FCF rows where delta_nwc is entered as a negative (cash outflow) instead of a positive investment; sign-convention mismatches when importing third-party models.","solutions":["Pass delta_nwc as the increase in net working capital (positive = investment) and compute fcff from the bridge","Verify sign conventions of capex and delta_nwc against the formula before constructing","Use fcff_bridge() to derive all fields consistently"],"exampleFix":"# before\nFCFFYear(..., delta_nwc=-20.0, fcff=85.0)  # treated negative as release\n\n# after\nFCFFYear(..., delta_nwc=20.0, fcff=nopat + da - capex - 20.0)","handlingStrategy":"validation","validationCode":"fcff = nopat + da - capex - delta_nwc\nFCFFYear(..., fcff=fcff)","typeGuard":null,"tryCatchPattern":"try:\n    FCFFYear(...)\nexcept ValueError as e:\n    if 'bridge total' in str(e):\n        raise DataImportError(f'sign convention mismatch in bridge inputs: {e}') from e\n    raise","preventionTips":["delta_nwc positive = investment (cash outflow); check convention before import","Compute fcff from the four components in code","Never copy a third-party FCF row without reconciling the bridge"],"tags":["valuation","fcff","sign-convention","reconciliation"],"backgroundTag":"derived-field-mismatch","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}