{"record":{"id":"78c2768f12f82397","repo":"nautechsystems/nautilus_trader","slug":"load-index-order-client-channel-closed-e","errorCode":null,"errorMessage":"load_index_order_client channel closed: {e}","messagePattern":"load_index_order_client channel closed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/redis/cache.rs","lineNumber":1504,"sourceCode":"\n        blocking_recv(&rx)\n            .map_err(|e| anyhow::anyhow!(\"load_index_order_position channel closed: {e}\"))?\n    }\n\n    fn load_index_order_client(&self) -> anyhow::Result<AHashMap<ClientOrderId, ClientId>> {\n        let con = self.database.con.clone();\n        let trader_key = self.database.trader_key.clone();\n        let (tx, rx) = mpsc::channel();\n\n        get_runtime().spawn(async move {\n            let result = DatabaseQueries::load_index_order_client(&con, &trader_key).await;\n            if let Err(e) = tx.send(result) {\n                log::error!(\"Failed to send load_index_order_client result: {e:?}\");\n            }\n        });\n\n        blocking_recv(&rx)\n            .map_err(|e| anyhow::anyhow!(\"load_index_order_client channel closed: {e}\"))?\n    }\n\n    async fn load_currency(&self, code: &Ustr) -> anyhow::Result<Option<Currency>> {\n        DatabaseQueries::load_currency(\n            &self.database.con,\n            &self.database.trader_key,\n            code,\n            self.encoding(),\n        )\n        .await\n    }\n\n    async fn load_instrument(\n        &self,\n        instrument_id: &InstrumentId,\n    ) -> anyhow::Result<Option<InstrumentAny>> {\n        DatabaseQueries::load_instrument(\n            &self.database.con,","sourceCodeStart":1486,"sourceCodeEnd":1522,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/redis/cache.rs#L1486-L1522","documentation":"Loads the (client_order_id → client_id) index from Redis through the same worker-thread + mpsc pattern. This error means `blocking_recv(&rx)` got `RecvError` because the sending task terminated without sending — a panic, drop, or early exit in the worker.","triggerScenarios":"Calling the client-order index load during cache load when the spawned task fails before `tx.send(result)` (deserialization panic on index entries, connection drop inside the task, task cancellation).","commonSituations":"Corrupt or schema-changed index data in Redis; runtime shutdown during startup; incompatible data written by an older nautilus version.","solutions":["Check logs right before the error for the real cause (panic trace or send-failure log)","Verify the index_order_client keys in Redis deserialize under the current encoding; delete/rewrite bad entries","Retry the load once the Redis connection is stable","Propagate worker errors through the channel to avoid this opaque RecvError wrapper"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust\nmatch cache.load_index_order_client() {\n    Ok(index) => index,\n    Err(e) if e.to_string().contains(\"channel closed\") => {\n        log::warn!(\"retrying index_order_client load after channel close: {e:#}\");\n        cache.load_index_order_client()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Inspect preceding logs for the worker's real failure (panic or send failure)","Ensure index entries in Redis match the current schema/encoding","Do not issue loads during runtime teardown","Harden the loader task to send Err results instead of dying silently"],"tags":["redis","channel","index","async"],"backgroundTag":"channel-closed","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"}