{"record":{"id":"7773367f4c5bb1e2","repo":"nautechsystems/nautilus_trader","slug":"unsupported-operation-read-for-collection-col","errorCode":null,"errorMessage":"Unsupported operation: `read` for collection '{collection}'","messagePattern":"Unsupported operation: `read` for collection '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/redis/queries.rs","lineNumber":251,"sourceCode":"    /// # Errors\n    ///\n    /// Returns an error if the underlying Redis read operation fails or if the collection is unsupported.\n    pub async fn read(\n        con: &ConnectionManager,\n        trader_key: &str,\n        key: &str,\n    ) -> anyhow::Result<Vec<Bytes>> {\n        let collection = Self::get_collection_key(key)?;\n        let full_key = format!(\"{trader_key}{REDIS_DELIMITER}{key}\");\n\n        let mut con = con.clone();\n\n        match collection {\n            INDEX => Self::read_index(&mut con, &full_key).await,\n            GENERAL | CURRENCIES | INSTRUMENTS | INSTRUMENT_CLOSES | SYNTHETICS | ACTORS\n            | STRATEGIES => Self::read_string(&mut con, &full_key).await,\n            ACCOUNTS | ORDERS | POSITIONS | SNAPSHOTS => Self::read_list(&mut con, &full_key).await,\n            _ => anyhow::bail!(\"Unsupported operation: `read` for collection '{collection}'\"),\n        }\n    }\n\n    /// Loads all cache data (currencies, instruments, synthetics, accounts, orders, positions) for `trader_key`.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if loading any of the individual caches fails or combining data fails.\n    pub async fn load_all(\n        con: &ConnectionManager,\n        encoding: SerializationEncoding,\n        trader_key: &str,\n    ) -> anyhow::Result<CacheMap> {\n        let (currencies, instruments, instrument_closes, synthetics, accounts, orders, positions) =\n            tokio::try_join!(\n                Self::load_currencies(con, trader_key, encoding),\n                Self::load_instruments(con, trader_key, encoding),\n                Self::load_instrument_closes(con, trader_key, encoding),","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/redis/queries.rs#L233-L269","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncache.read(\"Orders\", &key).await?; // wrong casing/collection\n// after\ncache.read(ORDERS, &key).await?;   // use the supported collection constant","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[&str] = &[INDEX, GENERAL, CURRENCIES, INSTRUMENTS, INSTRUMENT_CLOSES, SYNTHETICS, ACTORS, STRATEGIES, ACCOUNTS, ORDERS, POSITIONS, SNAPSHOTS];\nfn is_supported_collection(c: &str) -> bool { SUPPORTED.contains(&c) }\nif !is_supported_collection(collection) { return Err(anyhow!(\"collection {collection} not supported by redis cache read\")); }","typeGuard":"fn is_supported_collection(c: &str) -> bool { SUPPORTED.contains(&c) }","tryCatchPattern":null,"preventionTips":["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"],"tags":["redis","cache","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}