nautechsystems/nautilus_trader · error

Postgres execution requires an active payload key and deploy

Error message

Postgres execution requires an active payload key and deployment identity

What it means

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.

Source

Thrown at crates/adapters/blockchain/src/execution/client.rs:5867

            self.signer = None;
            self.pending_tasks
                .start_generation()
                .map_err(|e| anyhow::anyhow!("Failed to start blockchain task generation: {e}"))?;
        }
        release_preparing_slot(&self.in_flight);

        let setup_guard = TaskGroupGuard::new(&[&self.pending_tasks], || {});

        let payload_keys = PayloadKeySet::load(
            self.config.payload_key_env.as_deref(),
            &self.config.payload_key_retired_env,
            self.config.payload_deployment_id.as_deref(),
        )?
        .map(Arc::new);

        if self.cache.database.is_some() || self.config.postgres_cache_database_config.is_some() {
            let keys = payload_keys.as_deref().ok_or_else(|| {
                anyhow::anyhow!(
                    "Postgres execution requires an active payload key and deployment identity"
                )
            })?;

            if self.cache.database.is_none() {
                let pg_options = self
                    .config
                    .postgres_cache_database_config
                    .as_ref()
                    .expect("Postgres configuration checked above");
                let database = crate::cache::database::BlockchainCacheDatabase::connect(
                    pg_options.clone().into(),
                )
                .await
                .map_err(|e| {
                    anyhow::anyhow!("Failed to connect to the Postgres cache database: {e}")
                })?;
                self.cache.database = Some(database);

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set config.payload_deployment_id (and related identity fields) so a payload key can be resolved or created
  2. Provision/activate a payload key in the Postgres payload key store before starting the client
  3. Verify the database config points at the intended environment's database where active keys exist
  4. If Postgres execution is not intended, remove postgres_cache_database_config and any cached database wiring

Example fix

// before
config.postgres_cache_database_config = Some(pg_config);
// payload_deployment_id: None  -> error
// after
config.postgres_cache_database_config = Some(pg_config);
config.payload_deployment_id = Some("my-deployment-id".to_string());
Defensive patterns

Strategy: validation

Validate before calling

// before starting the client
if config.postgres_cache_database_config.is_some() {
    assert!(config.payload_deployment_id.is_some(), "payload deployment id required for Postgres execution");
    assert!(payload_key_store.has_active_key().await?, "no active payload key provisioned");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/cec333e8ff353617. Report an issue: GitHub.