{"record":{"id":"0abbcbc6ef88b091","repo":"nautechsystems/nautilus_trader","slug":"update-strategy-not-implemented-for-postgresql-cac","errorCode":null,"errorMessage":"update_strategy not implemented for PostgreSQL cache adapter: {strategy_id}","messagePattern":"update_strategy not implemented for PostgreSQL cache adapter: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/sql/cache.rs","lineNumber":1262,"sourceCode":"                \"Failed to send query index_order_clients to database message handler: {e}\"\n            )\n        })\n    }\n\n    fn update_actor(\n        &self,\n        actor_id: &ActorId,\n        _state: &AHashMap<String, Bytes>,\n    ) -> anyhow::Result<()> {\n        anyhow::bail!(\"update_actor not implemented for PostgreSQL cache adapter: {actor_id}\")\n    }\n\n    fn update_strategy(\n        &self,\n        strategy_id: &StrategyId,\n        _state: &AHashMap<String, Bytes>,\n    ) -> anyhow::Result<()> {\n        anyhow::bail!(\"update_strategy not implemented for PostgreSQL cache adapter: {strategy_id}\")\n    }\n\n    fn update_account(&self, account: &AccountAny) -> anyhow::Result<()> {\n        let query = DatabaseQuery::AddAccount(account_last_event(account)?, true);\n        self.tx.send(query).map_err(|e| {\n            anyhow::anyhow!(\"Failed to send query add_account to database message handler: {e}\")\n        })\n    }\n\n    fn update_order(&self, event: &OrderEventAny) -> anyhow::Result<()> {\n        let query = DatabaseQuery::UpdateOrder(event.clone());\n        self.tx.send(query).map_err(|e| {\n            anyhow::anyhow!(\"Failed to send query update_order to database message handler: {e}\")\n        })\n    }\n\n    fn update_position(&self, position: &Position) -> anyhow::Result<()> {\n        let query = if position.fill_voids.is_empty() {","sourceCodeStart":1244,"sourceCodeEnd":1280,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/sql/cache.rs#L1244-L1280","documentation":"update_strategy() in the PostgreSQL cache adapter is a stub that always fails with this message including the strategy_id. Persisting strategy state snapshots to Postgres is not implemented, identical in nature to the update_actor stub right above it.","triggerScenarios":"Calling cache.update_strategy(&strategy_id, &state) — typically a strategy checkpoint/save path — when the cache database is the PostgreSQL adapter in crates/infrastructure/src/sql/cache.rs.","commonSituations":"Running strategies with periodic state persistence enabled on a node using the Postgres cache; migrating from a backend that stores strategy state to Postgres and assuming the save path works; recovery flows that persist state before shutdown.","solutions":["Disable strategy state persistence when using the Postgres cache adapter, or keep strategy state in memory","Upgrade nautilus_trader in case a newer release implements update_strategy for the SQL adapter","Implement update_strategy in the adapter (mirror update_actor/AddAccount-style query flow over self.tx)","Handle the error per-strategy at the call site so persistence gaps don't halt the node"],"exampleFix":"// before\ncache.update_strategy(&strategy_id, &state)?;\n// after\nif let Err(e) = cache.update_strategy(&strategy_id, &state) {\n    log::warn!(\"strategy state not persisted (Postgres adapter): {e}\");\n}","handlingStrategy":"try-catch","validationCode":"let persist_strategy_state = !matches!(cache_database, CacheDatabase::Postgres);","typeGuard":null,"tryCatchPattern":"if let Err(e) = cache.update_strategy(&strategy_id, &state) {\n    log::warn!(\"update_strategy skipped (not implemented): {e}\");\n}","preventionTips":["Disable strategy state snapshots when the cache database is Postgres","Treat unimplemented stubs in sql/cache.rs as capability limits, not transient errors","Handle persistence failures per-strategy so a save never aborts the trading loop"],"tags":["rust","postgresql","not-implemented","strategy-state","cache-adapter"],"backgroundTag":"method-not-implemented","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"}