{"record":{"id":"cec333e8ff353617","repo":"nautechsystems/nautilus_trader","slug":"postgres-execution-requires-an-active-payload-key","errorCode":null,"errorMessage":"Postgres execution requires an active payload key and deployment identity","messagePattern":"Postgres execution requires an active payload key and deployment identity","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":5867,"sourceCode":"            self.signer = None;\n            self.pending_tasks\n                .start_generation()\n                .map_err(|e| anyhow::anyhow!(\"Failed to start blockchain task generation: {e}\"))?;\n        }\n        release_preparing_slot(&self.in_flight);\n\n        let setup_guard = TaskGroupGuard::new(&[&self.pending_tasks], || {});\n\n        let payload_keys = PayloadKeySet::load(\n            self.config.payload_key_env.as_deref(),\n            &self.config.payload_key_retired_env,\n            self.config.payload_deployment_id.as_deref(),\n        )?\n        .map(Arc::new);\n\n        if self.cache.database.is_some() || self.config.postgres_cache_database_config.is_some() {\n            let keys = payload_keys.as_deref().ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"Postgres execution requires an active payload key and deployment identity\"\n                )\n            })?;\n\n            if self.cache.database.is_none() {\n                let pg_options = self\n                    .config\n                    .postgres_cache_database_config\n                    .as_ref()\n                    .expect(\"Postgres configuration checked above\");\n                let database = crate::cache::database::BlockchainCacheDatabase::connect(\n                    pg_options.clone().into(),\n                )\n                .await\n                .map_err(|e| {\n                    anyhow::anyhow!(\"Failed to connect to the Postgres cache database: {e}\")\n                })?;\n                self.cache.database = Some(database);","sourceCodeStart":5849,"sourceCodeEnd":5885,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L5849-L5885","documentation":"When Postgres-backed execution is enabled (an existing cache database or a postgres_cache_database_config is set), the client requires an active payload key plus a payload deployment identity to namespace durable payloads. If payload key resolution returned None, startup fails with this error. It ensures every submitted transaction payload is durably keyed and attributable to a deployment.","triggerScenarios":"Starting the client with cache.database or config.postgres_cache_database_config set while the payload key store resolves no active key (payload_keys None), e.g. no payload deployment id configured and no key stored in the database.","commonSituations":"Config missing payload_deployment_id; fresh database with no payload keys provisioned; keys rotated/revoked so none is active; connecting to the wrong database (empty or another environment's schema).","solutions":["Set config.payload_deployment_id (and related identity fields) so a payload key can be resolved or created","Provision/activate a payload key in the Postgres payload key store before starting the client","Verify the database config points at the intended environment's database where active keys exist","If Postgres execution is not intended, remove postgres_cache_database_config and any cached database wiring"],"exampleFix":"// before\nconfig.postgres_cache_database_config = Some(pg_config);\n// payload_deployment_id: None  -> error\n// after\nconfig.postgres_cache_database_config = Some(pg_config);\nconfig.payload_deployment_id = Some(\"my-deployment-id\".to_string());","handlingStrategy":"validation","validationCode":"// before starting the client\nif config.postgres_cache_database_config.is_some() {\n    assert!(config.payload_deployment_id.is_some(), \"payload deployment id required for Postgres execution\");\n    assert!(payload_key_store.has_active_key().await?, \"no active payload key provisioned\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set payload_deployment_id when enabling Postgres-backed execution","Provision/activate a payload key in the store before client startup","Verify the database config points at the environment where your payload keys exist","If you don't need Postgres execution, remove the cache database config entirely"],"tags":["configuration","postgres","payload-keys"],"backgroundTag":"missing-required-config-field","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"}