{"record":{"id":"6a83f8876da38744","repo":"nautechsystems/nautilus_trader","slug":"unsupported-operation-replace-list-for-collecti","errorCode":null,"errorMessage":"Unsupported operation: `replace_list` for collection '{collection}'","messagePattern":"Unsupported operation: `replace_list` for collection '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/redis/cache.rs","lineNumber":1034,"sourceCode":"fn replace_list(pipe: &mut Pipeline, key: &str, value: &[u8]) {\n    pipe.del(key);\n    pipe.rpush(key, value);\n}\n\nfn replace_list_operation(\n    pipe: &mut Pipeline,\n    collection: &str,\n    key: &str,\n    value: &[Bytes],\n) -> anyhow::Result<()> {\n    check_slice_not_empty(value, stringify!(value))?;\n\n    match collection {\n        ACCOUNTS | ORDERS | POSITIONS => {\n            replace_list(pipe, key, value[0].as_ref());\n            Ok(())\n        }\n        _ => anyhow::bail!(\"Unsupported operation: `replace_list` for collection '{collection}'\"),\n    }\n}\n\nfn update(pipe: &mut Pipeline, collection: &str, key: &str, value: &[Bytes]) -> anyhow::Result<()> {\n    check_slice_not_empty(value, stringify!(value))?;\n\n    match collection {\n        ACCOUNTS | ORDERS | POSITIONS => {\n            update_list(pipe, key, value[0].as_ref());\n            Ok(())\n        }\n        _ => anyhow::bail!(\"Unsupported operation: `update` for collection '{collection}'\"),\n    }\n}\n\nfn update_list(pipe: &mut Pipeline, key: &str, value: &[u8]) {\n    pipe.rpush_exists(key, value);\n}","sourceCodeStart":1016,"sourceCodeEnd":1052,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/redis/cache.rs#L1016-L1052","documentation":"replace_list_operation only supports full-list replacement for the ACCOUNTS, ORDERS, and POSITIONS collections. Any other collection passed to it hits the wildcard arm and bails with this error. It enforces that Redis list replacement is not attempted on collections stored with a different Redis structure.","triggerScenarios":"Calling replace_list (via the operation dispatcher / drain flush path) with collection set to something other than ACCOUNTS/ORDERS/POSITIONS, e.g. SIGNALS, CUSTOM_DATA, INDEX, or a typo'd collection name.","commonSituations":"Custom cache integrations invoking the lower-level operation functions directly with unsupported collections; refactoring that repurposed drain/flush paths for new collections; passing an index key where a collection name was expected.","solutions":["Check the collection string passed into the drain/replace path; it must be one of ACCOUNTS, ORDERS, POSITIONS.","Use the correct operation for the collection type (e.g. delete or set for string-backed collections instead of replace_list).","If you need list semantics for a new collection, add a match arm in replace_list_operation with an appropriate implementation.","Replace ad-hoc calls with the supported Cache API methods so routing matches the collection."],"exampleFix":"// before\nreplace_list(pipe, \"SIGNALS\", key, value)?; // unsupported\n// after\nreplace_list(pipe, ORDERS, key, value)?; // supported collection","handlingStrategy":"try-catch","validationCode":"const REPLACEABLE: [&str; 3] = [ACCOUNTS, ORDERS, POSITIONS];\nassert!(REPLACEABLE.contains(&collection), \"replace_list not supported for {collection}\");","typeGuard":null,"tryCatchPattern":"// Python\ntry:\n    cache.replace_list(collection, key, value)\nexcept RuntimeError as e:\n    if \"Unsupported operation: `replace_list`\" in str(e):\n        log.error(\"Collection %s does not support list replacement\", collection)\n    else:\n        raise","preventionTips":["Use the high-level Cache API instead of calling operation functions directly.","Keep a map of collection -> supported operations and consult it before writes.","Spell collection names from the constants, never as raw strings."],"tags":["redis","cache","unsupported-operation","collection"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}