{"record":{"id":"fc25854c3dc67fce","repo":"nautechsystems/nautilus_trader","slug":"python-on-resume-failed-e","errorCode":null,"errorMessage":"Python on_resume failed: {e}","messagePattern":"Python on_resume failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/trading/src/python/algorithm.rs","lineNumber":559,"sourceCode":"}\n\nimpl DataActor for PyExecutionAlgorithm {\n    fn on_start(&mut self) -> anyhow::Result<()> {\n        ExecutionAlgorithm::on_start(self)?;\n        self.dispatch_no_args(\"on_start\")\n            .map_err(|e| anyhow::anyhow!(\"Python on_start failed: {e}\"))\n    }\n\n    fn on_stop(&mut self) -> anyhow::Result<()> {\n        ExecutionAlgorithm::on_stop(self)?;\n        self.dispatch_no_args(\"on_stop\")\n            .map_err(|e| anyhow::anyhow!(\"Python on_stop failed: {e}\"))\n    }\n\n    fn on_resume(&mut self) -> anyhow::Result<()> {\n        ExecutionAlgorithm::on_resume(self)?;\n        self.dispatch_no_args(\"on_resume\")\n            .map_err(|e| anyhow::anyhow!(\"Python on_resume failed: {e}\"))\n    }\n\n    fn on_reset(&mut self) -> anyhow::Result<()> {\n        ExecutionAlgorithm::on_reset(self)?;\n        self.dispatch_no_args(\"on_reset\")\n            .map_err(|e| anyhow::anyhow!(\"Python on_reset failed: {e}\"))\n    }\n\n    fn on_dispose(&mut self) -> anyhow::Result<()> {\n        self.dispatch_no_args(\"on_dispose\")\n            .map_err(|e| anyhow::anyhow!(\"Python on_dispose failed: {e}\"))\n    }\n\n    fn on_degrade(&mut self) -> anyhow::Result<()> {\n        self.dispatch_no_args(\"on_degrade\")\n            .map_err(|e| anyhow::anyhow!(\"Python on_degrade failed: {e}\"))\n    }\n","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/python/algorithm.rs#L541-L577","documentation":"The DataActor on_resume path runs Rust ExecutionAlgorithm::on_resume then dispatches the Python `on_resume` callback; Python-side exceptions are re-wrapped with this message. It signals the Python component failed when resuming from a degraded/stopped state.","triggerScenarios":"Calling on_resume when the Python on_resume raises — e.g. reconnection logic fails, or the callback signature/state is wrong for the no-arg dispatch.","commonSituations":"Resume after degradation where upstream services are still unavailable; stale cached handles that died while degraded; missing on_resume override spelled incorrectly (e.g. onresume).","solutions":["Read the chained `{e}` traceback and fix the Python on_resume implementation.","Re-establish/revalidate connections inside on_resume rather than reusing handles captured earlier.","Verify the exact method name and zero-arg signature (`def on_resume(self)`).","Ensure on_start/on_reset left state consistent so resume is possible."],"exampleFix":"// before\ndef on_resume(self, reason): ...  # extra arg\n\n// after\ndef on_resume(self): ...","handlingStrategy":"try-catch","validationCode":"# Python: verify resume prerequisites\nassert self.degraded or self.started, \"on_resume called outside degraded/stopped state\"","typeGuard":null,"tryCatchPattern":"if let Err(e) = actor.on_resume() {\n    log::error!(\"python on_resume failed: {e:#}\");\n    // re-degrade or fault the actor rather than assuming it resumed\n}","preventionTips":["Rebuild/revalidate connections in on_resume instead of reusing handles from before degradation.","Spell and sign lifecycle hooks exactly: on_start/on_stop/on_resume/on_reset/on_dispose/on_degrade.","Integration-test degrade -> resume cycles, not just start/stop."],"tags":["rust","python","pyo3","lifecycle","on-resume"],"backgroundTag":"api-error-response","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}