QuantConnect/Lean · error · RegressionTestException
_customWarmUp indicator was expected to have processed 60 da
Error message
_customWarmUp indicator was expected to have processed 60 datapoints already
What it means
This RegressionTestException is thrown in Initialize after confirming _customWarmUp.IsReady. It asserts that _customWarmUp.Samples equals exactly 60, verifying the warm-up process fed precisely WarmUpPeriod data points. LEAN throws it because warm-up should feed exactly one data point per period in the history window — more indicates duplicate feeding, fewer indicates insufficient history.
Source
Thrown at Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs:66
_duplicateSMA = new SimpleMovingAverage("_duplicateSMA", 60);
// Register the daily data of "SPY" to automatically update both indicators
RegisterIndicator("SPY", _customWarmUp, Resolution.Minute);
RegisterIndicator("SPY", _customNotWarmUp, Resolution.Minute);
RegisterIndicator("SPY", _customNotInherit, Resolution.Minute);
RegisterIndicator("SPY", _duplicateSMA, Resolution.Minute);
// Warm up _customWarmUp indicator
WarmUpIndicator("SPY", _customWarmUp, Resolution.Minute);
// Check _customWarmUp indicator has already been warmed up with the requested data
if (!_customWarmUp.IsReady)
{
throw new RegressionTestException("_customWarmUp indicator was expected to be ready");
}
if (_customWarmUp.Samples != 60)
{
throw new RegressionTestException("_customWarmUp indicator was expected to have processed 60 datapoints already");
}
// Try to warm up _customNotWarmUp indicator. It's expected from LEAN to skip the warm up process
// because this indicator doesn't implement IIndicatorWarmUpPeriodProvider
WarmUpIndicator("SPY", _customNotWarmUp, Resolution.Minute);
// Check _customNotWarmUp indicator is not ready, because the warm up process was skipped
if (_customNotWarmUp.IsReady)
{
throw new RegressionTestException("_customNotWarmUp indicator wasn't expected to be warmed up");
}
WarmUpIndicator("SPY", _customNotInherit, Resolution.Minute);
// Check _customWarmUp indicator has already been warmed up with the requested data
if (!_customNotInherit.IsReady)
{
throw new RegressionTestException("_customNotInherit indicator was expected to be ready");
}View on GitHub (pinned to d2c3659f87)
Solutions
- Log _customWarmUp.Samples to determine if it's above or below 60.
- If below: verify minute history data exists for at least 60 bars before SetStartDate (2013-10-07).
- If above: check that the indicator wasn't pre-fed by RegisterIndicator or a previous WarmUpIndicator call.
- If testing engine changes, trace the warm-up history retrieval to confirm it fetches exactly WarmUpPeriod bars.
Example fix
// before — if warm-up feeds WarmUpPeriod+1 bars due to off-by-one // Engine code (hypothetical): var history = History<IBaseData>(symbol, warmUpPeriod + 1, resolution); // off by one foreach (var bar in history) indicator.Update(bar); // after var history = History<IBaseData>(symbol, warmUpPeriod, resolution); // exact count foreach (var bar in history) indicator.Update(bar);
Defensive patterns
Strategy: validation
Validate before calling
// Validate sample count after warm-up
WarmUpIndicator("SPY", _customWarmUp, Resolution.Minute);
if (_customWarmUp.Samples != 60)
Log($"Unexpected sample count: {_customWarmUp.Samples}, expected 60. Check history data availability."); Prevention
- Ensure history data has at least WarmUpPeriod bars before StartDate.
- Don't call RegisterIndicator with live data before WarmUpIndicator — it could add extra samples.
- Verify the warm-up history fetch requests exactly WarmUpPeriod bars, not more.
When it happens
Trigger: _customWarmUp.Samples != 60 after WarmUpIndicator. If Samples > 60, the indicator was fed extra points (duplicate warm-up or pre-existing samples). If Samples < 60, the history provider delivered fewer than 60 minute bars before StartDate.
Common situations: History data file truncated so fewer than 60 pre-StartDate minute bars exist, warm-up feeding logic changed to feed a different count (e.g. WarmUpPeriod + 1), or the indicator was already partially fed before WarmUpIndicator was called.
Related errors
- _customNotInherit indicator was expected to have processed 6
- _customWarmUp indicator was expected to be ready
- _customNotWarmUp indicator wasn't expected to be warmed up
- _customNotInherit indicator was expected to be ready
- _duplicateSMA indicator was expected to be ready
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/c5d6337a5e37b0ec.
Report an issue: GitHub.