{"record":{"id":"27ed24a4eb421899","repo":"nautechsystems/nautilus_trader","slug":"update-actor-not-implemented-for-postgresql-cache","errorCode":null,"errorMessage":"update_actor not implemented for PostgreSQL cache adapter: {actor_id}","messagePattern":"update_actor not implemented for PostgreSQL cache adapter: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/sql/cache.rs","lineNumber":1254,"sourceCode":"    fn index_order_clients(&self, claims: &[(ClientOrderId, ClientId)]) -> anyhow::Result<()> {\n        if claims.is_empty() {\n            return Ok(());\n        }\n\n        let query = DatabaseQuery::IndexOrderClients(claims.to_vec());\n        self.tx.send(query).map_err(|e| {\n            anyhow::anyhow!(\n                \"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<()> {","sourceCodeStart":1236,"sourceCodeEnd":1272,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/sql/cache.rs#L1236-L1272","documentation":"update_actor() in the PostgreSQL cache adapter is a stub that always bails with this message including the actor_id. Persisting actor state snapshots to Postgres is unsupported, so any actor state save through this adapter fails. It is an explicit unimplemented feature, not a data or connection problem.","triggerScenarios":"Calling cache.update_actor(&actor_id, &state) — e.g. an actor framework snapshot/checkpoint path — while the cache database is the PostgreSQL adapter in crates/infrastructure/src/sql/cache.rs.","commonSituations":"Enabling actor state persistence in a live or sandbox node configured with the Postgres cache; migrating nodes from a cache backend that supports actor state to Postgres; periodic state-saving logic that fires automatically for every actor.","solutions":["Avoid actor state persistence with the Postgres adapter (keep state in memory) or disable periodic state snapshots in the actor/node config","Upgrade nautilus_trader in case a newer release implements update_actor for the SQL adapter","Implement update_actor in the adapter: write the serialized state rows for actor_id as done for other entities, then send the query over self.tx","Catch the error per-actor so one failed snapshot does not abort the whole trading loop"],"exampleFix":"// before\nlet state: AHashMap<String, Bytes> = actor.snapshot_state();\ncache.update_actor(&actor_id, &state)?;\n// after\nif let Err(e) = cache.update_actor(&actor_id, &state) {\n    log::warn!(\"actor state not persisted (Postgres adapter): {e}\");\n}","handlingStrategy":"try-catch","validationCode":"// disable actor state persistence when using the SQL cache\nlet persist_actor_state = !matches!(cache_database, CacheDatabase::Postgres);","typeGuard":null,"tryCatchPattern":"if let Err(e) = cache.update_actor(&actor_id, &state) {\n    log::warn!(\"update_actor skipped (not implemented): {e}\");\n}","preventionTips":["Audit actor/strategy persistence features against adapter support before enabling them in config","Keep actor state in memory when using the Postgres cache adapter","Watch upstream releases for update_actor implementation in the SQL adapter"],"tags":["rust","postgresql","not-implemented","actor-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-14T05:17:10.506Z"}