{"record":{"id":"9a5f97a0df39cc48","repo":"nautechsystems/nautilus_trader","slug":"protected-payload-keys-are-not-initialized-connec","errorCode":null,"errorMessage":"Protected payload keys are not initialized; connect the client first","messagePattern":"Protected payload keys are not initialized; connect the client first","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":970,"sourceCode":"    fn payload_policy(&self) -> PayloadPolicy {\n        PayloadPolicy {\n            chain_id: self.chain.chain_id,\n            signer: self.wallet_address,\n            gas_limit: self.config.gas_limit,\n            max_fee_per_gas: self.config.max_fee_per_gas_wei,\n        }\n    }\n\n    fn transaction_executor(&self) -> anyhow::Result<TransactionExecutor> {\n        let database = self.cache.database.clone().ok_or_else(|| {\n            anyhow::anyhow!(\"No durable store configured; refusing to submit a transaction\")\n        })?;\n        let signer = self\n            .signer\n            .clone()\n            .ok_or_else(|| anyhow::anyhow!(\"Signer not initialized; connect the client first\"))?;\n        let payload_keys = self.payload_keys.clone().ok_or_else(|| {\n            anyhow::anyhow!(\"Protected payload keys are not initialized; connect the client first\")\n        })?;\n        let verification_config = self\n            .config\n            .verification\n            .as_ref()\n            .expect(\"verification config validated at construction\");\n        let identities = std::iter::once(&verification_config.authoritative)\n            .chain(\n                verification_config\n                    .verifiers\n                    .iter()\n                    .map(|provider| &provider.identity),\n            )\n            .collect::<Vec<_>>();\n\n        Ok(TransactionExecutor {\n            http_rpc_client: self.http_rpc_client.clone(),\n            verification: self.verification.clone(),","sourceCodeStart":952,"sourceCodeEnd":988,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L952-L988","documentation":"transaction_executor() clones the payload_keys set (protected encryption keys used when persisting execution payloads). These are initialized during connect(); if missing, transaction construction cannot safely persist the intent, so the client raises this error alongside the signer check.","triggerScenarios":"Calling wrap(), approve(), submit_order(), or reconcile_unresolved_execution() before connect() initialized self.payload_keys, or when keys were never loaded because no key set is persisted.","commonSituations":"Same lifecycle mistakes as the signer error: orders submitted pre-connect; partial initialization after failed connect; fresh database never protected so no keys were loaded.","solutions":["Ensure client.connect() completes before submitting transactions.","Run protect_payload_storage() once (disconnected) so a key set exists to load on connect.","If connect failed, fix the key-store/database error and reconnect.","Gate order submission behind post-connect readiness."],"exampleFix":"// before\nif !client.is_connected() { client.connect().await?; }\nclient.submit_order(order).await?; // may still race connect internals\n// after\nclient.connect().await?;\nanyhow::ensure!(client.is_connected(), \"client not connected\");\nclient.submit_order(order).await?;","handlingStrategy":"validation","validationCode":"anyhow::ensure!(client.is_connected(), \"connect first so payload keys and signer are initialized\");\nclient.submit_order(order).await?;","typeGuard":null,"tryCatchPattern":"if let Err(e) = client.submit_order(order).await {\n    if e.to_string().contains(\"payload keys are not initialized\") {\n        client.connect().await?;\n        client.submit_order(order).await?;\n    } else { return Err(e.into()); }\n}","preventionTips":["Protect payload storage once at setup so keys persist for later connects.","Gate all submission paths on post-connect readiness.","Verify key loading in connect logs after each restart."],"tags":["rust","blockchain","encryption","lifecycle"],"backgroundTag":"authentication-required","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"}