nautechsystems/nautilus_trader · error
Unsupported operation: `read` for collection '{collection}'
Error message
Unsupported operation: `read` for collection '{collection}' What it means
The Redis cache adapter's `read` operation dispatches on the collection name and only supports a fixed set: INDEX, GENERAL, CURRENCIES, INSTRUMENTS, INSTRUMENT_CLOSES, SYNTHETICS, ACTORS, STRATEGIES (string reads), and ACCOUNTS, ORDERS, POSITIONS, SNAPSHOTS (list reads). Any other collection string fails fast with this bail! so unsupported reads never silently return empty data.
Source
Thrown at crates/infrastructure/src/redis/queries.rs:251
/// # Errors
///
/// Returns an error if the underlying Redis read operation fails or if the collection is unsupported.
pub async fn read(
con: &ConnectionManager,
trader_key: &str,
key: &str,
) -> anyhow::Result<Vec<Bytes>> {
let collection = Self::get_collection_key(key)?;
let full_key = format!("{trader_key}{REDIS_DELIMITER}{key}");
let mut con = con.clone();
match collection {
INDEX => Self::read_index(&mut con, &full_key).await,
GENERAL | CURRENCIES | INSTRUMENTS | INSTRUMENT_CLOSES | SYNTHETICS | ACTORS
| STRATEGIES => Self::read_string(&mut con, &full_key).await,
ACCOUNTS | ORDERS | POSITIONS | SNAPSHOTS => Self::read_list(&mut con, &full_key).await,
_ => anyhow::bail!("Unsupported operation: `read` for collection '{collection}'"),
}
}
/// Loads all cache data (currencies, instruments, synthetics, accounts, orders, positions) for `trader_key`.
///
/// # Errors
///
/// Returns an error if loading any of the individual caches fails or combining data fails.
pub async fn load_all(
con: &ConnectionManager,
encoding: SerializationEncoding,
trader_key: &str,
) -> anyhow::Result<CacheMap> {
let (currencies, instruments, instrument_closes, synthetics, accounts, orders, positions) =
tokio::try_join!(
Self::load_currencies(con, trader_key, encoding),
Self::load_instruments(con, trader_key, encoding),
Self::load_instrument_closes(con, trader_key, encoding),View on GitHub (pinned to 18893faf8b)
Solutions
- Check the collection name against the supported constants in crates/infrastructure/src/redis/queries.rs (INDEX, GENERAL, CURRENCIES, INSTRUMENTS, INSTRUMENT_CLOSES, SYNTHETICS, ACTORS, STRATEGIES, ACCOUNTS, ORDERS, POSITIONS, SNAPSHOTS) and fix the typo/wrong name
- If you need a genuinely new collection, extend the match in RedisCache::read to route it to read_string or read_list
- Confirm the nautilus version matches the one that wrote the cache data; upgrade the adapter if the collection only exists in a newer version
Example fix
// before
cache.read("Orders", &key).await?; // wrong casing/collection
// after
cache.read(ORDERS, &key).await?; // use the supported collection constant Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED: &[&str] = &[INDEX, GENERAL, CURRENCIES, INSTRUMENTS, INSTRUMENT_CLOSES, SYNTHETICS, ACTORS, STRATEGIES, ACCOUNTS, ORDERS, POSITIONS, SNAPSHOTS];
fn is_supported_collection(c: &str) -> bool { SUPPORTED.contains(&c) }
if !is_supported_collection(collection) { return Err(anyhow!("collection {collection} not supported by redis cache read")); } Type guard
fn is_supported_collection(c: &str) -> bool { SUPPORTED.contains(&c) } Prevention
- Reference the exported collection constants instead of hardcoding collection name strings
- Keep cache-writing and cache-reading code on the same nautilus version
- List keys in Redis first when writing tooling against the cache
When it happens
Trigger: Calling CacheConfig/RedisCache read with a collection key that is not one of the supported constants — typically a typo'd collection name, a collection added in a newer nautilus version but read through an older adapter, or a custom collection passed to the generic read API.
Common situations: Hand-editing a cache database namespace or snapshot tooling that enumerates collections; mixing trader cache data written by a different nautilus version that introduced a new collection; scripting against Redis directly with a wrong key suffix.
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
- Unsupported operation: `replace_list` for collection '{colle
- Unsupported operation: `update` for collection '{collection}
- Unsupported operation: `delete` for collection '{collection}
- Unsupported index operation: remove from '{index_key}'
- Index unknown '{index_key}' on read
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/7773367f4c5bb1e2.
Report an issue: GitHub.