HKUDS/Vibe-Trading · error · ValuationError
{MODEL_NAME}: every driver sequence must share one length (o
Error message
{MODEL_NAME}: every driver sequence must share one length (one entry per projected period); got {detail} What it means
project_three_statement requires every driver sequence (revenue growth, margins, capex, etc. — DRIVER_REQUIRED_FIELDS) to have the same length, one entry per projected period. If lengths differ, _resolve_period_count raises ValuationError listing each field and its length so you can see which array is short or long.
Source
Thrown at agent/src/quantlib/valuation/threestatement.py:495
def _resolve_period_count(drivers: Mapping[str, Sequence[float]]) -> int:
"""Validate every driver sequence shares one non-zero length and return it.
Args:
drivers: The driver mapping already checked by
:func:`~src.quantlib.valuation.contracts.require_inputs`.
Returns:
The number of periods to project.
Raises:
ValuationError: If the driver sequences disagree in length, or all are
empty.
"""
lengths = {field: len(drivers[field]) for field in DRIVER_REQUIRED_FIELDS}
distinct = set(lengths.values())
if len(distinct) > 1:
detail = ", ".join(f"{field}={n}" for field, n in lengths.items())
raise ValuationError(
f"{MODEL_NAME}: every driver sequence must share one length (one entry "
f"per projected period); got {detail}"
)
periods = distinct.pop()
if periods < 1:
raise ValuationError(
f"{MODEL_NAME}: driver sequences are empty; at least one projection "
"period is required"
)
return periods
def _project_period(
period: int,
prior_bs: BalanceSheet,
prior_revenue: float,
revenue_growth: float,
gross_margin: float,View on GitHub (pinned to 80ffdda44c)
Solutions
- Compare the per-field lengths in the message and re-slice/re-extend the offending arrays to a common horizon.
- Build all driver arrays from one shared periods index (e.g. one DataFrame column per field).
- Assert equal lengths in a helper before calling project_three_statement.
Example fix
# before
drivers = {"revenue_growth": [0.1]*5, "capex_pct": [0.03]*4, ...}
# after
n = 5
drivers = {"revenue_growth": [0.1]*n, "capex_pct": [0.03]*n, ...} Defensive patterns
Strategy: validation
Validate before calling
lengths = {len(v) for v in drivers.values()}
assert len(lengths) == 1, f'driver lengths diverge: {lengths}' Type guard
def drivers_aligned(drivers) -> bool:
return len({len(v) for v in drivers.values()}) == 1 Try / catch
except ValuationError as e:
if 'share one length' in str(e): parse_lengths_and_reslice(e) Prevention
- Derive all driver columns from one shared forecast index
- Extend horizons by regenerating, not by appending to individual lists
When it happens
Trigger: Passing a drivers dict where, say, revenue_growth has 5 entries but capex_pct has 4 — typically from slicing different date ranges or appending to one list and forgetting another.
Common situations: Drivers assembled from multiple spreadsheets/DataFrames with mismatched horizons; extending the forecast horizon for some lines only; off-by-one when adding a stub period.
Related errors
- BalanceSheetError(balance_sheet.period, assets, liabilities,
- {model}: {name} must be a number, got {value!r}
- {model}: {name} must be a finite number, got {numeric!r}
- {MODEL_NAME}: driver sequences are empty; at least one proje
- ConvergenceError(period, iterations, delta, circularity_tole
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/2272a113e593f485.
Report an issue: GitHub.