{"record":{"id":"9a6cd8b98c283c32","repo":"nautechsystems/nautilus_trader","slug":"execution-payload-marker-exists-without-state","errorCode":null,"errorMessage":"Execution payload marker exists without state","messagePattern":"Execution payload marker exists without state","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":4712,"sourceCode":"        .await\n        .context(\"failed to read execution payload marker\")?;\n\n        let version = marker.ok_or_else(|| {\n            anyhow::anyhow!(\"Postgres execution requires protected payload storage\")\n        })?;\n        anyhow::ensure!(\n            version == EXECUTION_PAYLOAD_PROTOCOL_VERSION,\n            \"Unsupported execution payload protection version {version}\"\n        );\n        let row = sqlx::query(\n            \"SELECT deployment_id, protocol_version, operation, active_key_id \\\n             FROM execution_payload_state WHERE component = 'signed_transactions' \\\n             FOR SHARE\",\n        )\n        .fetch_optional(&mut *transaction)\n        .await\n        .context(\"failed to lock execution payload state\")?\n        .ok_or_else(|| anyhow::anyhow!(\"Execution payload marker exists without state\"))?;\n        let state = execution_payload_state_from_row(&row)?;\n        validate_execution_payload_state(&state, keys)?;\n        anyhow::ensure!(\n            state.operation == \"ready\",\n            \"Execution payload storage is in {} maintenance\",\n            state.operation\n        );\n\n        Ok(ExecutionPayloadLease {\n            _transaction: transaction,\n        })\n    }\n\n    /// Reserves one nonce use under the active payload key.\n    pub(crate) async fn reserve_execution_payload_seal(\n        &self,\n        keys: &PayloadKeySet,\n    ) -> anyhow::Result<()> {","sourceCodeStart":4694,"sourceCodeEnd":4730,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L4694-L4730","documentation":"acquire_execution_payload_lease reads the execution_payload_state row after confirming the execution_schema_version marker exists. The marker indicates protected payload storage is provisioned, so a missing state row means the two tables are inconsistent (the state row was deleted or never seeded). The library refuses to hand out a lease against half-provisioned protection.","triggerScenarios":"Calling acquire_execution_payload_lease (used before signing, payload access, acknowledgment, or broadcast) when execution_payload_state has no row for component 'signed_transactions' while the execution_schema_version marker for EXECUTION_PAYLOAD_COMPONENT exists.","commonSituations":"Partial or interrupted activation of protected storage; someone manually deleted the execution_payload_state row; restoring a database from a partial backup; running against a schema mutated outside the library's activation path.","solutions":["Re-run the library's execution payload activation/initialization path (activate_execution_payload_storage) to (re)seed the state row","Check execution_payload_state for component='signed_transactions' and restore the missing row from a backup if activation will not recreate it","Never delete rows from execution_payload_state manually; if decommissioning protection, use the library's deactivate/maintenance operations","Restore the database from a consistent backup rather than a partial one"],"exampleFix":"-- before (inconsistent db)\nSELECT * FROM execution_payload_state; -- empty\n-- after: re-run activation via the library API so the state row is seeded\n// db.require_execution_payload_storage_ready(&keys).await?;","handlingStrategy":"try-catch","validationCode":"let state: Option<_> = sqlx::query(\n    \"SELECT deployment_id FROM execution_payload_state WHERE component = 'signed_transactions'\",\n).fetch_optional(&pool).await?;\nif state.is_none() {\n    return Err(anyhow!(\"payload state missing; run activation first\"));\n}","typeGuard":null,"tryCatchPattern":"match db.acquire_execution_payload_lease(&keys).await {\n    Ok(lease) => { /* sign/broadcast */ }\n    Err(e) if e.to_string().contains(\"marker exists without state\") => {\n        // re-run activation/initialization, then retry once\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always initialize protected storage through the library's activation API, never by hand-editing tables","Take consistent (single-transaction) database backups","Restrict direct DELETE/UPDATE access to execution_payload_state","Monitor for schema/state drift between environments"],"tags":["database","invariant","postgres"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}