{"record":{"id":"e1c719623400e44c","repo":"QuantConnect/Lean","slug":"option-delisting-warning-was-not-received","errorCode":null,"errorMessage":"Option delisting warning was not received","messagePattern":"Option delisting warning was not received","errorType":"exception","errorClass":"RegressionTestException","httpStatus":null,"severity":"error","filePath":"Algorithm.CSharp/DuplicateOptionAssignmentRegressionAlgorithm.cs","lineNumber":172,"sourceCode":"        {\n            if (!_optionSold)\n            {\n                throw new RegressionTestException(\"Option was not sold\");\n            }\n\n            if (!_optionAssigned)\n            {\n                throw new RegressionTestException(\"Option was not assigned\");\n            }\n\n            if (!_stockAssigned)\n            {\n                throw new RegressionTestException(\"Stock was not assigned\");\n            }\n\n            if (!_optionDelistedWarningReceived)\n            {\n                throw new RegressionTestException(\"Option delisting warning was not received\");\n            }\n\n            if (!_optionDelisted)\n            {\n                throw new RegressionTestException(\"Option was not delisted\");\n            }\n\n            if (!_orderCanceled)\n            {\n                throw new RegressionTestException(\"Order was not canceled\");\n            }\n\n            var openOrders = Transactions.GetOpenOrders();\n            if (openOrders.Count != 0)\n            {\n                throw new RegressionTestException(\"There should be no open orders\");\n            }\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.CSharp/DuplicateOptionAssignmentRegressionAlgorithm.cs#L154-L190","documentation":"Postcondition: _optionDelistedWarningReceived must be true. The option must have emitted a DelistingType.Warning before the algorithm ended. Failure means the warning phase of delisting never occurred during the run.","triggerScenarios":"The algorithm ended before the delisting warning date, the warning event was suppressed, or the OnDelistings guard rejected it before setting the flag.","commonSituations":"End date moved earlier than the option's delisting-warning date; delisting date metadata changed in data; the OnDelistings precondition (101) threw earlier so the flag was never set.","solutions":["Ensure the algorithm date range includes the option's delisting warning date.","Confirm errors 100/101 did not fire earlier in the run (they would abort before the flag is set).","Verify the delisting warning is emitted by the Security's delisting provider for the option."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the date range reaches the delisting-warning date\nvar warningDate = _option.ID.Date; // last trading date proximity\nif (Time < warningDate) Log(\"Backtest ends before the delisting warning date\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Extend the end date past the option delisting-warning date.","Resolve failures in earlier OnDelistings guards first (100/101), since they abort before the flag is set.","Verify the delisting provider emits a Warning phase for the option."],"tags":["quantconnect","lean","regression-test","options","delisting","postcondition"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}