HKUDS/Vibe-Trading · error · ValuationError
fcff_bridge: {name} has {len(values)} year(s), expected {hor
Error message
fcff_bridge: {name} has {len(values)} year(s), expected {horizon} to match ebit What it means
fcff_bridge() requires depreciation_amortization, capex and delta_nwc to have exactly the same length as ebit; otherwise a ValuationError names the mismatched series and its length.
Source
Thrown at agent/src/quantlib/valuation/dcf.py:622
"""
if not 0.0 <= tax_rate <= 1.0:
raise ValuationError(f"fcff_bridge: tax_rate must be within [0, 1], got {tax_rate!r}")
ebit_list = list(ebit)
horizon = len(ebit_list)
if horizon == 0:
raise ValuationError(
"fcff_bridge: ebit forecast is empty; at least one projection year "
"is required"
)
forecasts = {
"depreciation_amortization": list(depreciation_amortization),
"capex": list(capex),
"delta_nwc": list(delta_nwc),
}
for name, values in forecasts.items():
if len(values) != horizon:
raise ValuationError(
f"fcff_bridge: {name} has {len(values)} year(s), expected "
f"{horizon} to match ebit"
)
years = []
for index in range(horizon):
ebit_value = _require_finite(ebit_list[index], f"ebit[{index}]", "fcff_bridge")
da_value = _require_finite(
forecasts["depreciation_amortization"][index],
f"depreciation_amortization[{index}]",
"fcff_bridge",
)
capex_value = _require_finite(
forecasts["capex"][index], f"capex[{index}]", "fcff_bridge"
)
delta_nwc_value = _require_finite(
forecasts["delta_nwc"][index], f"delta_nwc[{index}]", "fcff_bridge"
)View on GitHub (pinned to 80ffdda44c)
Solutions
- Align all four series to the same horizon/length before calling (assert equal lengths)
- When extending the forecast horizon, update all assumption rows together
- If using pandas, reset/reindex all series on a common positional index before list()
Example fix
# before fcff_bridge(ebit=df['ebit'], capex=df['capex'].dropna(), ...) # after capex = df['capex'].reindex(df['ebit'].index).fillna(0.0) fcff_bridge(ebit=df['ebit'], capex=capex, ...)
Defensive patterns
Strategy: validation
Validate before calling
n = len(list(ebit)) assert all(len(list(x)) == n for x in (da, capex, dnwc)), 'length mismatch' fcff_bridge(ebit=ebit, depreciation_amortization=da, capex=capex, delta_nwc=dnwc)
Type guard
def same_length(*seqs) -> bool:
n = len(list(seqs[0]))
return all(len(list(s)) == n for s in seqs) Try / catch
try:
fcff_bridge(...)
except ValuationError as e:
if 'expected' in str(e):
raise DataAlignmentError(str(e)) from e
raise Prevention
- Extend all assumption series together when changing horizon
- Reindex pandas series on a common positional index before list()
- Assert equal lengths in a pre-flight check
When it happens
Trigger: Passing a 5-year ebit with a 4-year capex list; a scalar or single D&A value broadcast by hand to the wrong length; misaligned DataFrame slices.
Common situations: Horizon extended for ebit but not for other assumptions; pandas series aligned on different indices silently producing different lengths after dropna.
Related errors
- FCFFYear.year must be >= 1, got {self.year!r}
- FCFFYear(year={self.year}).nopat={self.nopat!r} does not mat
- FCFFYear(year={self.year}).fcff={self.fcff!r} does not match
- fcff_bridge: tax_rate must be within [0, 1], got {tax_rate!r
- fcff_bridge: ebit forecast is empty; at least one projection
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/027089e59b56b3cd.
Report an issue: GitHub.