QuantConnect/Lean · error · RegressionTestException

Custom data was not received

Error message

Custom data was not received

What it means

Same 'custom data not received' assertion for the multi-CSV zipped file variant (without the ZipEntryName entry-name tracking). _receivedCustomData stays false if no CustomData point ever reaches OnData. The data source is a remote zip containing multiple CSV files that Lean must concatenate and emit as one stream.

Source

Thrown at Algorithm.CSharp/CustomDataZipFileRegressionAlgorithm.cs:58

            SetBenchmark(x => 0);
        }

        public override void OnData(Slice slice)
        {
            var data = slice.Get<CustomData>(_customDataSymbol);
            if (data != null)
            {
                Log($"{Time}: {data.Symbol} - {data.Time} - {data.Value}");
                _receivedCustomData = true;
            }
        }

        public override void OnEndOfAlgorithm()
        {
            if (!_receivedCustomData)
            {
                throw new RegressionTestException("Custom data was not received");
            }
        }

        protected virtual string GetCustomDataUrl()
        {
            return @"https://cdn.quantconnect.com/uploads/multi_csv_zipped_file.zip?some=query&for=testing";
        }

        public class CustomData : BaseData
        {
            public static string Url { get; set; }

            public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
            {
                return new SubscriptionDataSource(Url);
            }

            public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)

View on GitHub (pinned to d2c3659f87)

Solutions

  1. Verify the zip URL is reachable and the file contains CSV entries the Reader can parse.
  2. Ensure Reader sets Symbol, Time, and Value and does not return null on valid lines.
  3. Confirm GetCustomDataUrl points to the correct endpoint (overridable for local mirrors).
  4. Cache the zip locally and point GetCustomDataUrl at the local path for offline/CI runs.

Example fix

// before: Reader drops every row
public override BaseData Reader(...) { return null; }

// after: parse line into a point
public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
{
    var row = line.Split(',');
    return new CustomData { Symbol = config.Symbol, Time = date, Value = decimal.Parse(row[1]) };
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate the URL and parser produce points before the run depends on them
var url = GetCustomDataUrl();
if (string.IsNullOrWhiteSpace(url)) throw new InvalidOperationException("Empty custom data URL");

Try / catch

try { /* download/parse multi-csv zip */ }
catch (Exception ex) { Log($"Custom zip parse failed: {ex.Message}"); }

Prevention

When it happens

Trigger: GetCustomDataUrl returns the multi-csv zip; the zip is fetched and unpacked, but Reader never returns a point for any line, so slice.Get<CustomData> is null for the whole run.

Common situations: Remote zip unreachable, Reader throws/returns null on parse, Symbol/Value not set so the point is dropped, or the zip format changed (entries merged differently) after a data-pipeline update. Offline runs without a cached copy also trigger it.

Related errors


AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13). Data as JSON: /api/errors/678bfb688484f56e. Report an issue: GitHub.