{"record":{"id":"242b9a447f9b048c","repo":"nautechsystems/nautilus_trader","slug":"failed-to-load-strategy-strategy-id-state-e","errorCode":null,"errorMessage":"Failed to load strategy {strategy_id} state: {e:#}","messagePattern":"Failed to load strategy (.+?) state: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/system/src/trader.rs","lineNumber":1599,"sourceCode":"        for (actor_id, callbacks) in actor_callbacks {\n            let state = cache\n                .borrow()\n                .load_actor_state(&actor_id)\n                .map_err(|e| anyhow::anyhow!(\"Failed to load actor {actor_id} state: {e:#}\"))?;\n            let Some(state) = state.filter(|state| !state.is_empty()) else {\n                continue;\n            };\n\n            (callbacks.load)(actor_id.inner(), state)\n                .map_err(|e| anyhow::anyhow!(\"Failed to restore actor {actor_id} state: {e:#}\"))?;\n        }\n\n        for (strategy_id, callbacks) in strategy_callbacks {\n            let state = cache\n                .borrow()\n                .load_strategy_state(&strategy_id)\n                .map_err(|e| {\n                    anyhow::anyhow!(\"Failed to load strategy {strategy_id} state: {e:#}\")\n                })?;\n            let Some(state) = state.filter(|state| !state.is_empty()) else {\n                continue;\n            };\n\n            (callbacks.load)(strategy_id.inner(), state).map_err(|e| {\n                anyhow::anyhow!(\"Failed to restore strategy {strategy_id} state: {e:#}\")\n            })?;\n        }\n\n        Ok(())\n    }\n\n    /// Saves actor and strategy state in registration order.\n    ///\n    /// Empty state is persisted, while a cache without database backing does not invoke\n    /// component callbacks. All callbacks and updates receive an attempt before errors return.\n    ///","sourceCodeStart":1581,"sourceCodeEnd":1617,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/system/src/trader.rs#L1581-L1617","documentation":"Raised in `Trader::load_state` when the cache fails to load previously persisted state for a strategy (`cache.load_strategy_state`). The trader is restoring strategies after restart; a read error aborts the whole restore pass so strategies never start with silently missing state.","triggerScenarios":"Calling trader start with state recovery enabled when `load_strategy_state(strategy_id)` errors — backing-store connection failure, corrupted/expired key, or serialization error for that strategy's state key.","commonSituations":"Restarting a live node against a Redis cache that is down, has rotated credentials, or whose keys were written under a different schema/version; the strategy's state key was manually deleted or expired.","solutions":["Check the wrapped `{e:#}` chain for the root cause and restore backing-store connectivity/credentials","Verify cache backend config in the system config matches the store that wrote the state","If the persisted strategy state is from an incompatible version, clear the stale key and restart (strategy starts with empty state)","Re-save state from a run of the compatible version before restarting the upgraded node"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// confirm the strategy state key exists and is readable before restart\nmatch cache_backend.get(format!(\"strategy_state:{strategy_id}\")) {\n    Ok(Some(_)) => {},\n    other => handle(other),\n}","typeGuard":null,"tryCatchPattern":"match system.start_with_recovery() {\n    Err(e) if e.to_string().contains(\"Failed to load strategy\") => {\n        // restore backend connectivity or clear the stale key, then retry\n    }\n    other => other?,\n}","preventionTips":["Verify cache backend reachability and credentials before starting with recovery","Use the same cache config that saved the state","Avoid key expiry/TTL on persisted strategy state","Keep library versions consistent between saving and restoring runs"],"tags":["state","persistence","strategy","cache"],"backgroundTag":"state-load-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}