nautechsystems/nautilus_trader · error · anyhow::Error
Execution payload rewrap context does not match this databas
Error message
Execution payload rewrap context does not match this database
What it means
After loading execution_payload_state, the rewrap verifies the recorded protocol_version matches EXECUTION_PAYLOAD_PROTOCOL_VERSION and that the state's deployment_id equals the deployment id in the supplied PayloadKeySet. A mismatch means the keys or tool invocation belong to a different deployment or protocol generation, and the ensure! aborts before touching any rows.
Source
Thrown at crates/adapters/blockchain/src/cache/database.rs:5348
}
async fn begin_execution_payload_rewrap(&self, keys: &PayloadKeySet) -> anyhow::Result<()> {
let mut transaction = self
.pool
.begin()
.await
.context("failed to start execution payload rewrap")?;
lock_execution_payload_operation(&mut transaction).await?;
let state_row = sqlx::query(
"SELECT deployment_id, protocol_version, operation, active_key_id \
FROM execution_payload_state WHERE component = 'signed_transactions' FOR UPDATE",
)
.fetch_optional(&mut *transaction)
.await
.context("failed to lock execution payload state for rewrap")?
.ok_or_else(|| anyhow::anyhow!("Execution payload protection is not active"))?;
let state = execution_payload_state_from_row(&state_row)?;
anyhow::ensure!(
state.protocol_version == EXECUTION_PAYLOAD_PROTOCOL_VERSION
&& state.deployment_id == keys.deployment_id(),
"Execution payload rewrap context does not match this database"
);
match state.operation.as_str() {
"ready" => {
let current_id: [u8; 32] = state
.active_key_id
.as_slice()
.try_into()
.context("database active payload key ID is invalid")?;
anyhow::ensure!(
keys.contains_key(¤t_id),
"Current database payload key is not configured for rewrap"
);
validate_execution_payload_key_inventory(&mut transaction, keys).await?;
if current_id == *keys.active_key_id() {View on GitHub (pinned to 18893faf8b)
Solutions
- Point the rewrap at the correct database for the deployment id in your key configuration (or fix the deployment id config).
- Upgrade the software so EXECUTION_PAYLOAD_PROTOCOL_VERSION matches the database's recorded protocol_version.
- Rebuild the PayloadKeySet from the key material provisioned for this specific deployment.
- If the database was copied between environments, update execution_payload_state or use the source environment's key set.
Example fix
// before: mismatched deployment
let keys = PayloadKeySet::for_deployment("deployment-b");
rewrap_execution_payload_storage(&keys, 500).await?; // db is deployment-a
// after
let keys = PayloadKeySet::for_deployment("deployment-a");
rewrap_execution_payload_storage(&keys, 500).await?; Defensive patterns
Strategy: validation
Validate before calling
let (db_dep, ver): (String, i64) = sqlx::query_as(
"SELECT deployment_id, protocol_version FROM execution_payload_state WHERE component='signed_transactions'"
).fetch_one(&pool).await?;
assert_eq!(db_dep, keys.deployment_id(), "rewrap keys are for a different deployment");
assert_eq!(ver, EXECUTION_PAYLOAD_PROTOCOL_VERSION, "protocol version mismatch; upgrade software"); Prevention
- Derive the PayloadKeySet's deployment id from the same config source as the database connection.
- Pin tooling versions to the deployed protocol version.
- Never share one database across deployments without updating execution_payload_state.
When it happens
Trigger: Calling rewrap_execution_payload_storage with a PayloadKeySet whose deployment_id() differs from execution_payload_state.deployment_id, or when the stored protocol_version is not the current EXECUTION_PAYLOAD_PROTOCOL_VERSION.
Common situations: Running a rewrap tool configured for one deployment against another deployment's database; stale software version after a protocol bump; copying a database between environments without updating key/deployment configuration.
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 transaction {} requires an unavailable payload key
- Current database payload key is not configured for rewrap
- Implement FromRow for FuturesSpread
- Implement FromRow for OptionSpread
- Execution schema version {} is newer than supported version
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/1c3ada9233ac35bd.
Report an issue: GitHub.