nautechsystems/nautilus_trader · error
delete_account_event not implemented for PostgreSQL cache ad
Error message
delete_account_event not implemented for PostgreSQL cache adapter: {account_id}, {event_id} What it means
The PostgreSQL cache adapter does not implement delete_account_event; the call always fails, naming both the account id and event id. Removing individual account events from the SQL backend is unsupported.
Source
Thrown at crates/infrastructure/src/sql/cache.rs:901
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}")
}
fn delete_account_event(&self, account_id: &AccountId, event_id: &str) -> anyhow::Result<()> {
anyhow::bail!(
"delete_account_event not implemented for PostgreSQL cache adapter: {account_id}, {event_id}"
)
}
fn add(&self, key: String, value: Bytes) -> anyhow::Result<()> {
let query = DatabaseQuery::Add(key, value.into());
self.tx
.send(query)
.map_err(|e| anyhow::anyhow!("Failed to send query to database message handler: {e}"))
}
fn add_currency(&self, currency: &Currency) -> anyhow::Result<()> {
let query = DatabaseQuery::AddCurrency(*currency);
self.tx.send(query).map_err(|e| {
anyhow::anyhow!("Failed to query add_currency to database message handler: {e}")
})
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Perform the deletion directly in SQL out-of-band if truly required (with care for referential integrity)
- Use the Redis adapter where account event deletion is supported
- Implement delete_account_event in sql/cache.rs
Example fix
// before
cache_db.delete_account_event(&account_id, &event_id)?; // bails on Postgres
// after
// handle explicitly:
log::warn!("account event deletion not supported by SQL cache adapter; event {event_id} retained"); Defensive patterns
Strategy: try-catch
Validate before calling
if is_postgres_cache(&cache_db) { /* deletion unsupported — skip */ } Type guard
fn is_postgres_cache(db: &dyn CacheDatabase) -> bool { db.as_any().downcast_ref::<PostgresCache>().is_some() } Try / catch
if let Err(e) = cache_db.delete_account_event(&account_id, &event_id) {
if e.to_string().contains("not implemented") {
log::warn!("account event {event_id} not deleted (unsupported on SQL adapter)");
} else { return Err(e); }
} Prevention
- Handle account-event corrections at the database level with an audited migration
- Avoid per-event deletion flows on SQL-backed caches
- Review adapter support before building data-repair tooling
When it happens
Trigger: Calling delete_account_event(account_id, event_id) on a PostgreSQL cache database — e.g. correcting a bad account event or reconciliation cleanup.
Common situations: Data-repair scripts that assumed Redis parity; removing duplicated account state events; compliance-driven deletions on a Postgres-backed cache.
Related errors
- delete_order not implemented for PostgreSQL cache adapter: {
- delete_position not implemented for PostgreSQL cache adapter
- load_synthetic not implemented for PostgreSQL cache adapter:
- load_actor not implemented for PostgreSQL cache adapter: {ac
- load_strategy not implemented for PostgreSQL cache adapter:
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/a57f94c2ef4034cb.
Report an issue: GitHub.