{"record":{"id":"b883216de97fec84","repo":"QuantConnect/Lean","slug":"the-ticker-did-not-rename-throughout-the-course-of","errorCode":null,"errorMessage":"The ticker did not rename throughout the course of its life even though it should have","messagePattern":"The ticker did not rename throughout the course of its life even though it should have","errorType":"exception","errorClass":"RegressionTestException","httpStatus":null,"severity":"error","filePath":"Algorithm.CSharp/CustomDataUsingMapFileRegressionAlgorithm.cs","lineNumber":105,"sourceCode":"\n                    _executionMapping = true;\n                    SetHoldings(_symbol, 1);\n                }\n            }\n        }\n\n        /// <summary>\n        /// Final step of the algorithm\n        /// </summary>\n        public override void OnEndOfAlgorithm()\n        {\n            if (_initialMapping)\n            {\n                throw new RegressionTestException(\"The ticker generated the initial rename event\");\n            }\n            if (!_executionMapping)\n            {\n                throw new RegressionTestException(\"The ticker did not rename throughout the course of its life even though it should have\");\n            }\n        }\n\n        /// <summary>\n        /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.\n        /// </summary>\n        public bool CanRunLocally { get; } = true;\n\n        /// <summary>\n        /// This is used by the regression test system to indicate which languages this algorithm is written in.\n        /// </summary>\n        public List<Language> Languages { get; } = new() { Language.CSharp, Language.Python };\n\n        /// <summary>\n        /// Data Points count of all timeslices of algorithm\n        /// </summary>\n        public long DataPoints => 1667;\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.CSharp/CustomDataUsingMapFileRegressionAlgorithm.cs#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the map file for the custom symbol exists and covers the StartDate-EndDate range (check QuantConnect data folder / map_files).","Verify SymbolMappingMode is not disabled and that Initialize does not set it off.","Inspect the custom data type's reader/mapper to ensure it forwards renames via the configured mapper rather than a raw symbol string.","Adjust StartDate/EndDate so the test window includes the corporate-action date that causes the rename."],"exampleFix":"// before: mapping never fires because window misses the rename date\nSetStartDate(1998, 1, 1);\nSetEndDate(1998, 6, 30);\n\n// after: window straddles the mapped rename date\nSetStartDate(1998, 1, 1);\nSetEndDate(1999, 12, 31);","handlingStrategy":"validation","validationCode":"// Validate the map file exists and covers the range before running\nvar map = QuantConnect.Securities.SymbolPropertiesDatabase.FromDataFolder();\n// ensure StartDate..EndDate include a mapped rename date for the custom symbol","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the map file for the symbol spans your StartDate-EndDate before relying on execution-time renames.","Do not disable SymbolMappingMode when your strategy depends on remapping.","In custom data readers, forward symbols through the configured mapper instead of hardcoding the ticker."],"tags":["regression-test","symbol-mapping","custom-data","map-file"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}