QuantConnect/Lean · error · RegressionTestException
Custom data was not received
Error message
Custom data was not received
What it means
Asserts that custom data loaded from a zip file was delivered at least once. _receivedCustomData is set true in OnData when slice.Get<CustomData>(_customDataSymbol) is non-null; OnEndOfAlgorithm throws if it never became true. This variant specifically tests the ZipEntryName file format (it reads FileEntryName from each zip entry).
Source
Thrown at Algorithm.CSharp/CustomDataZipFileEntryNamesRegressionAlgorithm.cs:55
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.FileEntryName}");
_receivedCustomData = true;
}
}
public override void OnEndOfAlgorithm()
{
if (!_receivedCustomData)
{
throw new RegressionTestException("Custom data was not received");
}
}
public class CustomData : BaseData
{
private int _i;
public string FileEntryName { get; private set; }
public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
{
// Even though the url includes a specific entry name, FileFormat.ZipEntryName indicates that
// the entry names should be read, not the content of the given entry
return new SubscriptionDataSource(@"https://cdn.quantconnect.com/uploads/multi_csv_zipped_file.zip?some=query&for=testing#csv_file_10.csv",
SubscriptionTransportMedium.RemoteFile,
FileFormat.ZipEntryName);
}
View on GitHub (pinned to d2c3659f87)
Solutions
- Confirm network access to the zip URL and that the file downloads and contains named entries.
- Verify GetSource returns a SubscriptionDataSource with the correct SourceFormat and that config.FileFormat is ZipEntryName.
- Ensure the Reader handles the per-entry CSV lines and returns a populated CustomData instance (with FileEntryName set).
- If running offline, point GetSource at a local zip mirror under the data folder.
Example fix
// before: format defaults to CSV, entries never enumerated return new SubscriptionDataSource(url, SubscriptionTransportMedium.RemoteFile, FileFormat.Csv); // after: declare ZipEntryName so each entry is parsed return new SubscriptionDataSource(url, SubscriptionTransportMedium.RemoteFile, FileFormat.ZipEntryName);
Defensive patterns
Strategy: validation
Validate before calling
// Validate source reachability and format before relying on the feed
var src = new CustomData().GetSource(config, date, false);
if (src.Format != FileFormat.ZipEntryName)
throw new InvalidOperationException("Expected ZipEntryName format for zip-entry custom data"); Type guard
bool SourceIsZipEntry(SubscriptionDataSource s) => s.Format == FileFormat.ZipEntryName;
Try / catch
try { /* fetch/parse zip */ }
catch (WebException ex) { Log($"Custom data fetch failed: {ex.Message}"); /* fall back to local cache */ } Prevention
- Declare FileFormat.ZipEntryName in GetSource when reading per-entry data.
- Mirror remote zips locally for offline/CI runs.
- Ensure Reader sets FileEntryName and returns a populated instance for valid entries.
When it happens
Trigger: Custom data source is a remote zip with FileFormat.ZipEntryName; GetSource/Reader never materialize a point, so OnData never sees the symbol. Causes include unreachable URL, wrong file format flag, or Reader returning null for every entry.
Common situations: Network egress blocked to cdn.quantconnect.com (sandboxed CI, proxy, offline), zip layout changed so ZipEntryName parsing yields nothing, or the SubscriptionDataSource not configured with the ZipEntryName format so Lean treats entries as raw CSV.
Related errors
- Custom data was not received
- The ticker did not rename throughout the course of its life
- The time zone of security {firstCustomSecurity} should be {T
- The time zone of security {secondCustomSecurity} should be {
- {ActiveSecurities.Count.ToString().ToCamelCase()} data point
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/005a709fc2a95e7d.
Report an issue: GitHub.