nautechsystems/nautilus_trader · error

Unsupported operation: `delete` for collection '{collection}

Error message

Unsupported operation: `delete` for collection '{collection}'

What it means

delete supports removing entries only from the index (via delete_from_index) and from the ORDERS, POSITIONS, ACCOUNTS, ACTORS, and STRATEGIES string-keyed collections. Any other collection hits the wildcard arm and bails. It prevents delete commands being issued against collection keyspaces this adapter does not own.

Source

Thrown at crates/infrastructure/src/redis/cache.rs:1073

    pipe: &mut Pipeline,
    collection: &str,
    key: &str,
    value: Option<Vec<Bytes>>,
) -> anyhow::Result<()> {
    log::debug!(
        "delete: collection={}, key={}, has_payload={}",
        collection,
        key,
        value.is_some()
    );

    match collection {
        INDEX => delete_from_index(pipe, key, value),
        ORDERS | POSITIONS | ACCOUNTS | ACTORS | STRATEGIES => {
            delete_string(pipe, key);
            Ok(())
        }
        _ => anyhow::bail!("Unsupported operation: `delete` for collection '{collection}'"),
    }
}

fn delete_from_index(
    pipe: &mut Pipeline,
    key: &str,
    value: Option<Vec<Bytes>>,
) -> anyhow::Result<()> {
    let value = value.ok_or_else(|| anyhow::anyhow!("Empty `payload` for `delete` '{key}'"))?;
    let index_key = get_index_key(key)?;

    match index_key {
        INDEX_ORDER_IDS
        | INDEX_ORDERS
        | INDEX_ORDERS_OPEN
        | INDEX_ORDERS_CLOSED
        | INDEX_ORDERS_EMULATED
        | INDEX_ORDERS_INFLIGHT

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Confirm the collection argument is INDEX, ORDERS, POSITIONS, ACCOUNTS, ACTORS, or STRATEGIES.
  2. Remove unsupported collections via their dedicated APIs (e.g. purge/drop methods) instead of delete.
  3. Extend the match with a new arm if deletion for another collection is genuinely needed.
  4. Guard the call site: only invoke delete for collections the Redis adapter actually writes.

Example fix

// before
delete(pipe, "SIGNALS", key, value)?; // unsupported
// after
delete(pipe, STRATEGIES, key, value)?;
Defensive patterns

Strategy: try-catch

Validate before calling

const DELETABLE: [&str; 5] = [ORDERS, POSITIONS, ACCOUNTS, ACTORS, STRATEGIES];
assert!(collection == INDEX || DELETABLE.contains(&collection));

Try / catch

// Python
try:
    cache.delete(collection, key, value)
except RuntimeError as e:
    if "Unsupported operation: `delete`" in str(e):
        log.warning("Delete not supported for collection %s; skipping", collection)
    else:
        raise

Prevention

When it happens

Trigger: Calling delete (e.g. from py_delete) with a collection outside the supported set — INDEX handled specially, so any other collection such as SIGNALS, CUSTOM_DATA, or a typo'd name triggers the error.

Common situations: Custom cleanup/flush logic in Python calling cache.delete with an arbitrary collection name; test teardown deleting from collections never written by the Redis adapter; renamed collections after an upgrade.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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