nautechsystems/nautilus_trader · error · anyhow::Error
Stored execution payload has a truncated envelope header
Error message
Stored execution payload has a truncated envelope header
What it means
During key-inventory inspection the code reads stored envelope headers and requires each to be exactly 33 bytes (a version/type byte plus a 32-byte key ID). A shorter header means the stored envelope blob is corrupt or was written by an incompatible writer, so processing cannot proceed safely.
Source
Thrown at crates/adapters/blockchain/src/cache/database.rs:7551
);
Ok(())
}
async fn validate_execution_payload_key_inventory(
transaction: &mut Transaction<'_, Postgres>,
keys: &PayloadKeySet,
) -> anyhow::Result<()> {
let envelopes = sqlx::query_scalar::<_, Vec<u8>>(
"SELECT DISTINCT substring(sealed_transaction FROM 1 FOR 33) \
FROM execution_transaction_hash \
WHERE sealed_transaction IS NOT NULL",
)
.fetch_all(&mut **transaction)
.await
.context("failed to inspect execution payload key inventory")?;
for header in envelopes {
anyhow::ensure!(
header.len() == 33,
"Stored execution payload has a truncated envelope header"
);
let mut envelope = header;
envelope.extend_from_slice(&[0; 12 + 16]);
let key_id = envelope_key_id(&envelope)?;
anyhow::ensure!(
keys.contains_key(&key_id),
"Stored execution payload requires unavailable key {}",
alloy::hex::encode(key_id)
);
}
Ok(())
}
async fn load_execution_intent(
transaction: &mut Transaction<'_, Postgres>,
intent_id: i64,View on GitHub (pinned to 18893faf8b)
Solutions
- Identify and repair or delete the corrupt envelope row(s) in the execution payload tables
- Rebuild the cache/database from a known-good source if corruption is widespread
- Confirm the data was restored from a backup produced by a compatible software version
Defensive patterns
Strategy: validation
Validate before calling
for header in stored_envelope_headers() {
if header.len() != 33 {
flag_corrupt_row(header); // quarantine and repair before validation
}
} Prevention
- Never manually edit or import rows into payload tables
- Restore data only from backups made by a compatible version
- Monitor for partial writes/crashes and verify DB integrity after incidents
When it happens
Trigger: Running the key inventory validation when any stored execution payload envelope header in the database is shorter than 33 bytes.
Common situations: Corrupted rows from a partial write or crash; manual edits/truncated imports of the payload tables; restoring data from an incompatible backup or an older schema.
Related errors
- Implement FromRow for FuturesSpread
- Implement FromRow for OptionSpread
- Execution schema version {} is newer than supported version
- Verified finalized transaction count advanced without an act
- Execution payload storage is in {operation} maintenance; com
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/5f4ed7bd7324f9ba.
Report an issue: GitHub.