nautechsystems/nautilus_trader · critical
not yet implemented
Error message
not yet implemented
What it means
The PostgreSQL cache adapter's delete_actor is a stub: instead of deleting an actor's stored data it calls todo!(), which panics with 'not yet implemented'. The operation is simply not supported by this backend yet.
Source
Thrown at crates/infrastructure/src/sql/cache.rs:879
let pool = self.pool.clone();
let position_id = position_id.to_owned();
let (tx, rx) = std::sync::mpsc::channel();
tokio::spawn(async move {
let result = DatabaseQueries::load_position(&pool, &position_id).await;
if let Err(e) = tx.send(result) {
log::error!("Failed to send position {position_id}: {e:?}");
}
});
rx.recv()?
}
fn load_actor(&self, actor_id: &ActorId) -> anyhow::Result<AHashMap<String, Bytes>> {
anyhow::bail!("load_actor not implemented for PostgreSQL cache adapter: {actor_id}")
}
fn delete_actor(&self, _actor_id: &ActorId) -> anyhow::Result<()> {
todo!()
}
fn load_strategy(&self, strategy_id: &StrategyId) -> anyhow::Result<AHashMap<String, Bytes>> {
anyhow::bail!("load_strategy not implemented for PostgreSQL cache adapter: {strategy_id}")
}
fn delete_strategy(&self, _strategy_id: &StrategyId) -> anyhow::Result<()> {
todo!()
}
fn delete_order(&self, client_order_id: &ClientOrderId) -> anyhow::Result<()> {
anyhow::bail!(
"delete_order not implemented for PostgreSQL cache adapter: {client_order_id}"
)
}
fn delete_position(&self, position_id: &PositionId) -> anyhow::Result<()> {
anyhow::bail!("delete_position not implemented for PostgreSQL cache adapter: {position_id}")View on GitHub (pinned to 18893faf8b)
Solutions
- Do not call delete_actor with the PostgreSQL adapter; guard the call by backend type
- Implement delete_actor in crates/infrastructure/src/sql/cache.rs with the corresponding DELETE query
- Use a backend that supports actor deletion (e.g. the Redis adapter) if deletion is required
- Track upstream for the TODO being implemented and upgrade
Example fix
// before
cache_db.delete_actor(&actor_id)?; // panics with Postgres adapter
// after
match cache_db {
CacheBackend::Postgres(_) => log::warn!("delete_actor unsupported on Postgres adapter; skipped"),
_ => cache_db.delete_actor(&actor_id)?,
} Defensive patterns
Strategy: try-catch
Try / catch
// cannot catch todo!() panic in-process; feature-detect before calling
if !cache_db.supports(CacheFeature::DeleteActor) {
log::warn!("delete_actor unsupported on Postgres adapter; skipped");
} else {
cache_db.delete_actor(&actor_id)?;
} Prevention
- Check backend capability (Postgres adapter) before invoking delete operations
- Do not reuse Redis-specific purge routines with the Postgres adapter
- Pin/track upstream versions where the stub is implemented
- Consider implementing the method upstream via contribution
When it happens
Trigger: Calling cache.delete_actor(actor_id) on a cache database backed by the PostgreSQL adapter (NautilusPostgresCacheDatabase), e.g. while purging actor state from a live or backtest run.
Common situations: Running the same deletion code path that works with Redis/series backends but not with the Postgres adapter; enabling actor snapshot deletion in a Postgres-backed deployment.
Related errors
- Invalid `OrderType`
- Invalid `OrderSide`
- Invalid `TimeInForce`
- Invalid `LiquiditySide`
- Invalid `OrderStatus`
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/a6ef87991ea932e0.
Report an issue: GitHub.