nautechsystems/nautilus_trader · error · anyhow::Error
Configured active payload key does not match the database ac
Error message
Configured active payload key does not match the database active key
What it means
This ensure! checks that the active_key_id recorded in the stored ExecutionPayloadState equals the active key ID from the configured payload keys. It guards against loading payloads whose encryption key differs from the key the operator has configured, which would otherwise cause undecryptable data.
Source
Thrown at crates/adapters/blockchain/src/cache/database.rs:7493
operation: row.try_get("operation")?,
active_key_id: row.try_get("active_key_id")?,
})
}
fn validate_execution_payload_state(
state: &ExecutionPayloadState,
keys: &PayloadKeySet,
) -> anyhow::Result<()> {
anyhow::ensure!(
state.protocol_version == EXECUTION_PAYLOAD_PROTOCOL_VERSION,
"Execution payload protocol version {} is not supported",
state.protocol_version
);
anyhow::ensure!(
state.deployment_id == keys.deployment_id(),
"Execution payload deployment ID does not match this database"
);
anyhow::ensure!(
state.active_key_id.as_slice() == keys.active_key_id(),
"Configured active payload key does not match the database active key"
);
Ok(())
}
async fn lock_execution_payload_operation(
transaction: &mut Transaction<'_, Postgres>,
) -> anyhow::Result<()> {
let lock = PgAdvisoryLock::new("nautilus:blockchain:execution-payload");
let PgAdvisoryLockKey::BigInt(lock_key) = lock.key() else {
unreachable!("string advisory locks use the 64-bit key space");
};
sqlx::query("SELECT pg_advisory_xact_lock($1)")
.bind(*lock_key)
.execute(&mut **transaction)
.await
.context("failed to acquire execution payload operation fence")?;View on GitHub (pinned to 18893faf8b)
Solutions
- Align the configured active payload key with the key recorded in the database (or complete the rotation in the database)
- If the old key is intentionally retired, run the key-rotation procedure that updates the database's active key
- Verify key material/config files were not restored from an outdated backup
Defensive patterns
Strategy: validation
Validate before calling
if stored.active_key_id != configured_keys.active_key_id() {
return Err("active payload key out of sync with database".into());
} Prevention
- Perform key rotation atomically: update config and database together
- Verify key configuration against the database at startup
- Never restore config files from backups newer data depends on
When it happens
Trigger: The configured active payload key was rotated or replaced but the database still records a different active_key_id (or vice versa) when validation runs.
Common situations: Rotating payload keys on one node but not propagating the change to the database/config; restoring config from a backup while the DB was rotated; mismatched key material between replicas.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Execution payload storage is in {operation} maintenance; com
- Execution payload storage is in {operation} maintenance, not
- Legacy execution transaction {} contains an envelope
- Current database payload key is not configured for rewrap
- Execution payload deployment ID does not match this database
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/a5ea891ce9b89928.
Report an issue: GitHub.