nautechsystems/nautilus_trader · error

update_strategy not implemented for PostgreSQL cache adapter

Error message

update_strategy not implemented for PostgreSQL cache adapter: {strategy_id}

What it means

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.

Source

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

                "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<()> {
        let query = DatabaseQuery::UpdateOrder(event.clone());
        self.tx.send(query).map_err(|e| {
            anyhow::anyhow!("Failed to send query update_order to database message handler: {e}")
        })
    }

    fn update_position(&self, position: &Position) -> anyhow::Result<()> {
        let query = if position.fill_voids.is_empty() {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Disable strategy state persistence when using the Postgres cache adapter, or keep strategy state in memory
  2. Upgrade nautilus_trader in case a newer release implements update_strategy for the SQL adapter
  3. Implement update_strategy in the adapter (mirror update_actor/AddAccount-style query flow over self.tx)
  4. Handle the error per-strategy at the call site so persistence gaps don't halt the node

Example fix

// before
cache.update_strategy(&strategy_id, &state)?;
// after
if let Err(e) = cache.update_strategy(&strategy_id, &state) {
    log::warn!("strategy state not persisted (Postgres adapter): {e}");
}
Defensive patterns

Strategy: try-catch

Validate before calling

let persist_strategy_state = !matches!(cache_database, CacheDatabase::Postgres);

Try / catch

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

Prevention

When it happens

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

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

Related errors


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