QuantConnect/Lean · error · RegressionTestException

The ticker did not rename throughout the course of its life

Error message

The ticker did not rename throughout the course of its life even though it should have

What it means

Asserts that a custom-data symbol underwent a ticker remap (mapping) during execution. Lean applies map files to rename symbols across corporate actions; this test verifies the execution-time mapping event actually fired. Firing means _executionMapping was set true inside a mapping callback. If the run completes with only the initial mapping (or none), the map-file pipeline is broken.

Source

Thrown at Algorithm.CSharp/CustomDataUsingMapFileRegressionAlgorithm.cs:105

                    _executionMapping = true;
                    SetHoldings(_symbol, 1);
                }
            }
        }

        /// <summary>
        /// Final step of the algorithm
        /// </summary>
        public override void OnEndOfAlgorithm()
        {
            if (_initialMapping)
            {
                throw new RegressionTestException("The ticker generated the initial rename event");
            }
            if (!_executionMapping)
            {
                throw new RegressionTestException("The ticker did not rename throughout the course of its life even though it should have");
            }
        }

        /// <summary>
        /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
        /// </summary>
        public bool CanRunLocally { get; } = true;

        /// <summary>
        /// This is used by the regression test system to indicate which languages this algorithm is written in.
        /// </summary>
        public List<Language> Languages { get; } = new() { Language.CSharp, Language.Python };

        /// <summary>
        /// Data Points count of all timeslices of algorithm
        /// </summary>
        public long DataPoints => 1667;

View on GitHub (pinned to d2c3659f87)

Solutions

  1. Confirm the map file for the custom symbol exists and covers the StartDate-EndDate range (check QuantConnect data folder / map_files).
  2. Verify SymbolMappingMode is not disabled and that Initialize does not set it off.
  3. Inspect the custom data type's reader/mapper to ensure it forwards renames via the configured mapper rather than a raw symbol string.
  4. Adjust StartDate/EndDate so the test window includes the corporate-action date that causes the rename.

Example fix

// before: mapping never fires because window misses the rename date
SetStartDate(1998, 1, 1);
SetEndDate(1998, 6, 30);

// after: window straddles the mapped rename date
SetStartDate(1998, 1, 1);
SetEndDate(1999, 12, 31);
Defensive patterns

Strategy: validation

Validate before calling

// Validate the map file exists and covers the range before running
var map = QuantConnect.Securities.SymbolPropertiesDatabase.FromDataFolder();
// ensure StartDate..EndDate include a mapped rename date for the custom symbol

Prevention

When it happens

Trigger: Using AddData<T> with a type whose map file renames the symbol mid-run, then never receiving the MappedSymbol/Renamed event. Occurs when SymbolMappingMode is disabled, the map file is missing for the date range, or the custom data source does not propagate the mapping.

Common situations: Regression data updated so the rename falls outside the backtest window; SetStartDate/SetEndDate no longer straddle the mapping date; map-file resolver changed; or custom data type overrides Reader without calling the mapper. Also triggered if _initialMapping is true, meaning an unwanted initial rename fired instead.

Related errors


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