{"record":{"id":"5540aeac44f911ad","repo":"nautechsystems/nautilus_trader","slug":"batch-order-client-indexing-is-not-supported-by-th","errorCode":null,"errorMessage":"Batch order-client indexing is not supported by this cache database","messagePattern":"Batch order-client indexing is not supported by this cache database","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/common/src/cache/database.rs","lineNumber":524,"sourceCode":"    ///\n    /// Returns an error if indexing order-position mapping fails.\n    fn index_order_position(\n        &self,\n        client_order_id: ClientOrderId,\n        position_id: PositionId,\n    ) -> anyhow::Result<()>;\n\n    /// Indexes order-client mappings as one batch operation.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if batch order-client indexing is unsupported or cannot be enqueued.\n    fn index_order_clients(&self, claims: &[(ClientOrderId, ClientId)]) -> anyhow::Result<()> {\n        if claims.is_empty() {\n            return Ok(());\n        }\n\n        anyhow::bail!(\"Batch order-client indexing is not supported by this cache database\")\n    }\n\n    /// Updates actor state in the cache.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if updating actor state fails.\n    fn update_actor(\n        &self,\n        actor_id: &ActorId,\n        state: &AHashMap<String, Bytes>,\n    ) -> anyhow::Result<()>;\n\n    /// Updates strategy state in the cache.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if updating strategy state fails.","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/common/src/cache/database.rs#L506-L542","documentation":"The `CacheDatabase` trait's default `index_order_clients` implementation cannot batch-index order-client claims. Non-empty claim batches are rejected by this bail; only backends that override the method with a real implementation can support batch indexing. Empty input short-circuits to Ok.","triggerScenarios":"Calling `index_order_clients` with one or more `(ClientOrderId, ClientId)` claims on a cache database backend that uses the trait-default implementation (e.g. a simple/custom backend).","commonSituations":"Using a custom or minimal CacheDatabase implementation without overriding `index_order_clients`; a code path newly started to use batch indexing while the configured backend predates it; swapping the cache DB backend to one lacking the feature.","solutions":["Use a cache database backend that implements batch `index_order_clients` (e.g. the full Postgres/Redis backend)","Implement `index_order_clients` in your custom backend to persist the claims","Fall back to per-order client indexing at `add_order`/claim time instead of batch calls"],"exampleFix":"// before\nstruct MyDb;\nimpl CacheDatabase for MyDb {} // uses default that bails\n// after\nimpl CacheDatabase for MyDb {\n    fn index_order_clients(&self, claims: &[(ClientOrderId, ClientId)]) -> anyhow::Result<()> {\n        for (oid, cid) in claims { self.index_one(oid, cid)?; }\n        Ok(())\n    }\n}","handlingStrategy":"type-guard","validationCode":"if !backend.supports_batch_order_client_indexing() {\n    // fall back to per-order indexing via add_order paths\n}","typeGuard":"fn supports_batch_indexing(db: &dyn CacheDatabase) -> bool {\n    // true only for backends that override index_order_clients\n    db.implements_batch_order_client_indexing()\n}","tryCatchPattern":"if let Err(e) = db.index_order_clients(&claims) {\n    if e.to_string().contains(\"not supported\") {\n        for (oid, cid) in &claims { db.index_one(oid, cid)?; }\n    } else { return Err(e); }\n}","preventionTips":["Pick a backend that implements batch indexing","Override index_order_clients in custom backends","Gate batch indexing calls on backend capability"],"tags":["cache","database","unsupported"],"backgroundTag":"method-not-implemented","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"}