{"record":{"id":"ec2eee9f541731b7","repo":"nautechsystems/nautilus_trader","slug":"unsupported-index-operation-remove-from-index-k","errorCode":null,"errorMessage":"Unsupported index operation: remove from '{index_key}'","messagePattern":"Unsupported index operation: remove from '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/redis/cache.rs","lineNumber":1102,"sourceCode":"\n    match index_key {\n        INDEX_ORDER_IDS\n        | INDEX_ORDERS\n        | INDEX_ORDERS_OPEN\n        | INDEX_ORDERS_CLOSED\n        | INDEX_ORDERS_EMULATED\n        | INDEX_ORDERS_INFLIGHT\n        | INDEX_POSITIONS\n        | INDEX_POSITIONS_OPEN\n        | INDEX_POSITIONS_CLOSED => {\n            remove_from_set(pipe, key, value[0].as_ref());\n            Ok(())\n        }\n        INDEX_ORDER_POSITION | INDEX_ORDER_CLIENT => {\n            remove_from_hash(pipe, key, value[0].as_ref());\n            Ok(())\n        }\n        _ => anyhow::bail!(\"Unsupported index operation: remove from '{index_key}'\"),\n    }\n}\n\nfn remove_from_set(pipe: &mut Pipeline, key: &str, member: &[u8]) {\n    pipe.srem(key, member);\n}\n\nfn remove_from_hash(pipe: &mut Pipeline, key: &str, field: &[u8]) {\n    pipe.hdel(key, field);\n}\n\nfn delete_string(pipe: &mut Pipeline, key: &str) {\n    pipe.del(key);\n}\n\nfn full_redis_key(trader_key: &str, key: &str) -> String {\n    format!(\"{trader_key}{REDIS_DELIMITER}{key}\")\n}","sourceCodeStart":1084,"sourceCodeEnd":1120,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/redis/cache.rs#L1084-L1120","documentation":"delete_from_index handles removal from the two order-position index variants (INDEX_ORDER_POSITION, INDEX_ORDER_CLIENT) and, per the shown source, the set-based index arms above it. An index_key outside the recognized set falls to the wildcard arm and bails. This mirrors insert_index's exhaustiveness guard on the delete path.","triggerScenarios":"Calling delete with collection=INDEX and an index_key that is not one of the supported index constants (typo'd index name, custom index, or one added in a newer core version).","commonSituations":"Same version-skew and typo scenarios as the insert-side 'Index unknown' error: renamed index constants, forked custom indexes, or building index keys by string concatenation instead of using the constants.","solutions":["Log the index_key on the delete path and compare against the INDEX_* constants used by insert_index.","Use the same constants for insert and delete so both paths agree.","Add the missing match arm in delete_from_index if a new index type must support removal.","Sync crate versions between core and the redis adapter."],"exampleFix":"// before\ndelete(pipe, INDEX, \"order:idx_typo\", value)?; // unknown index\n// after\ndelete(pipe, INDEX, INDEX_ORDER_CLIENT, value)?;","handlingStrategy":"validation","validationCode":"const DELETABLE_INDEXES: [&str; 2] = [INDEX_ORDER_POSITION, INDEX_ORDER_CLIENT];\nassert!(DELETABLE_INDEXES.contains(&index_key), \"cannot remove from index {index_key}\");","typeGuard":null,"tryCatchPattern":"// Python\ntry:\n    cache.delete(INDEX, index_key, value)\nexcept RuntimeError as e:\n    if \"Unsupported index operation\" in str(e):\n        log.warning(\"Index %s does not support removal\", index_key)\n    else:\n        raise","preventionTips":["Use identical index constants on insert and delete paths.","Test delete symmetry: every index you insert into must be deletable.","Avoid string-built index names; import the constants."],"tags":["redis","cache","unsupported-operation","index"],"backgroundTag":"unsupported-enum-value","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"}