{"record":{"id":"7f36caa048327105","repo":"nautechsystems/nautilus_trader","slug":"invalid-key-missing-a-redis-delimiter-delim-7f36ca","errorCode":null,"errorMessage":"Invalid `key`, missing a '{REDIS_DELIMITER}' delimiter, was {key}","messagePattern":"Invalid `key`, missing a '(.+?)' delimiter, was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/redis/queries.rs","lineNumber":969,"sourceCode":"        let mut position = Position::new(&instrument, first_fill.clone());\n        for fill in remaining_fills {\n            if position.trade_ids().contains(&fill.trade_id) {\n                anyhow::bail!(\n                    \"Duplicate fill event for position {position_id}: {}\",\n                    fill.trade_id\n                );\n            }\n            position.apply(fill);\n        }\n\n        Ok(Some(position))\n    }\n\n    fn get_collection_key(key: &str) -> anyhow::Result<&str> {\n        key.split_once(REDIS_DELIMITER)\n            .map(|(collection, _)| collection)\n            .ok_or_else(|| {\n                anyhow::anyhow!(\"Invalid `key`, missing a '{REDIS_DELIMITER}' delimiter, was {key}\")\n            })\n    }\n\n    async fn read_index(conn: &mut ConnectionManager, key: &str) -> anyhow::Result<Vec<Bytes>> {\n        let index_key = get_index_key(key)?;\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 => Self::read_set(conn, key).await,\n            INDEX_ORDER_POSITION | INDEX_ORDER_CLIENT => Self::read_hset(conn, key).await,\n            _ => anyhow::bail!(\"Index unknown '{index_key}' on read\"),\n        }","sourceCodeStart":951,"sourceCodeEnd":987,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/redis/queries.rs#L951-L987","documentation":"get_collection_key splits a Redis key on the REDIS_DELIMITER (':') and returns the collection prefix (e.g. 'orders', 'positions'). If the key contains no delimiter it cannot be classified, so this error is thrown. It guards against malformed keys reaching the index/read layer.","triggerScenarios":"Calling internal read/index helpers (read_index, and any loader path that classifies keys) with a key string lacking ':', e.g. passing a bare name like \"mykey\" instead of \"orders:mykey\", or passing an index/data key with the prefix stripped incorrectly.","commonSituations":"Custom tooling composing Redis keys manually and omitting the delimiter; calling semi-internal APIs with raw collection names; keys constructed with a different delimiter convention in external code.","solutions":["Construct keys with the full form '<collection>:<rest>' using the library's key helpers (e.g. get_index_key / documented key formats).","Check the offending key for a missing or mistyped delimiter (e.g. using '-' instead of ':').","Pass the complete Redis key, not just the collection or suffix portion.","If migrating from external storage, normalize keys to the colon-delimited scheme before loading."],"exampleFix":"// before\nlet collection = get_collection_key(\"positions.OTP-001\")?; // no ':' delimiter\n// after\nlet collection = get_collection_key(\"positions:OTP-001\")?;","handlingStrategy":"validation","validationCode":"// Rust: ensure key is colon-delimited before use\nfn is_valid_redis_key(key: &str) -> bool {\n    key.contains(':') && !key.starts_with(':') && !key.ends_with(':')\n}","typeGuard":null,"tryCatchPattern":"if !is_valid_redis_key(key) {\n    return Err(anyhow::anyhow!(\"refusing to load malformed key: {key}\"));\n}\nlet collection = get_collection_key(key)?;","preventionTips":["Always compose Redis keys with the library's key builders instead of string concatenation.","Remember the delimiter is ':'; never substitute '-' or '.' in custom tooling.","Unit-test custom key construction against get_collection_key before deploying."],"tags":["redis","key-format","parsing"],"backgroundTag":"invalid-argument-format","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"}