nautechsystems/nautilus_trader · error

update_actor not implemented for PostgreSQL cache adapter: {

Error message

update_actor not implemented for PostgreSQL cache adapter: {actor_id}

What it means

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.

Source

Thrown at crates/infrastructure/src/sql/cache.rs:1254

    fn index_order_clients(&self, claims: &[(ClientOrderId, ClientId)]) -> anyhow::Result<()> {
        if claims.is_empty() {
            return Ok(());
        }

        let query = DatabaseQuery::IndexOrderClients(claims.to_vec());
        self.tx.send(query).map_err(|e| {
            anyhow::anyhow!(
                "Failed to send query index_order_clients to database message handler: {e}"
            )
        })
    }

    fn update_actor(
        &self,
        actor_id: &ActorId,
        _state: &AHashMap<String, Bytes>,
    ) -> anyhow::Result<()> {
        anyhow::bail!("update_actor not implemented for PostgreSQL cache adapter: {actor_id}")
    }

    fn update_strategy(
        &self,
        strategy_id: &StrategyId,
        _state: &AHashMap<String, Bytes>,
    ) -> anyhow::Result<()> {
        anyhow::bail!("update_strategy not implemented for PostgreSQL cache adapter: {strategy_id}")
    }

    fn update_account(&self, account: &AccountAny) -> anyhow::Result<()> {
        let query = DatabaseQuery::AddAccount(account_last_event(account)?, true);
        self.tx.send(query).map_err(|e| {
            anyhow::anyhow!("Failed to send query add_account to database message handler: {e}")
        })
    }

    fn update_order(&self, event: &OrderEventAny) -> anyhow::Result<()> {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Avoid actor state persistence with the Postgres adapter (keep state in memory) or disable periodic state snapshots in the actor/node config
  2. Upgrade nautilus_trader in case a newer release implements update_actor for the SQL adapter
  3. 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
  4. Catch the error per-actor so one failed snapshot does not abort the whole trading loop

Example fix

// before
let state: AHashMap<String, Bytes> = actor.snapshot_state();
cache.update_actor(&actor_id, &state)?;
// after
if let Err(e) = cache.update_actor(&actor_id, &state) {
    log::warn!("actor state not persisted (Postgres adapter): {e}");
}
Defensive patterns

Strategy: try-catch

Validate before calling

// disable actor state persistence when using the SQL cache
let persist_actor_state = !matches!(cache_database, CacheDatabase::Postgres);

Try / catch

if let Err(e) = cache.update_actor(&actor_id, &state) {
    log::warn!("update_actor skipped (not implemented): {e}");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/27ed24a4eb421899. Report an issue: GitHub.