{"record":{"id":"863b58327c8d4b5d","repo":"nautechsystems/nautilus_trader","slug":"execution-transaction-transaction-hash-was-not-f","errorCode":null,"errorMessage":"Execution transaction {transaction_hash} was not found for status update","messagePattern":"Execution transaction (.+?) was not found for status update","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":7411,"sourceCode":"        chain_id: u32,\n        transaction_hash: &str,\n        status: &str,\n    ) -> anyhow::Result<()> {\n        let result = sqlx::query(\n            \"\n            UPDATE execution_transaction\n            SET status = $3\n            WHERE chain_id = $1 AND transaction_hash = $2\n        \",\n        )\n        .bind(chain_id as i32)\n        .bind(transaction_hash)\n        .bind(status)\n        .execute(&self.pool)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to update execution_transaction table: {e}\"))?;\n\n        anyhow::ensure!(\n            result.rows_affected() == 1,\n            \"Execution transaction {transaction_hash} was not found for status update\"\n        );\n        Ok(())\n    }\n\n    /// Loads an execution transaction record by chain ID and transaction hash.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the database operation fails.\n    pub async fn get_execution_transaction(\n        &self,\n        chain_id: u32,\n        transaction_hash: &str,\n    ) -> anyhow::Result<Option<ExecutionTransactionRow>> {\n        let chain_id_db = i32::try_from(chain_id)\n            .with_context(|| format!(\"Chain ID {chain_id} exceeds PostgreSQL INTEGER\"))?;","sourceCodeStart":7393,"sourceCodeEnd":7429,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L7393-L7429","documentation":"This error is raised when an UPDATE on the `execution_transaction` table affected zero rows, meaning no row exists for the given transaction hash. The library enforces `rows_affected() == 1` after the status-update statement to guarantee the caller only advances statuses of transactions it previously persisted. It is an existence guard against silently updating nothing.","triggerScenarios":"Calling the transaction status update method with a transaction_hash that was never inserted into execution_transaction, or updating a row that was deleted concurrently.","commonSituations":"A consumer tracks a transaction hash from a different chain/database than the cache DB being updated; the row was pruned by retention/cleanup before the status callback arrived; a hash is passed from an unverified event source; replaying events after a database reset.","solutions":["Verify the transaction hash was previously inserted into execution_transaction for the same chain_id before updating its status","Check whether a retention/cleanup job deleted the row while the status update was in flight","Confirm you are connected to the same database/schema the transaction was written to","If the transaction may legitimately be absent, check existence first with a SELECT and skip the update instead of updating blindly"],"exampleFix":"// before\nupdate_status(&db, &missing_hash, Status::Confirmed).await?;\n// after\nif db.execution_transaction_exists(chain_id, &missing_hash).await? {\n    update_status(&db, &missing_hash, Status::Confirmed).await?;\n} else {\n    tracing::warn!(hash=%missing_hash, \"skipping status update for unknown execution transaction\");\n}","handlingStrategy":"validation","validationCode":"let exists: bool = sqlx::query_scalar(\"SELECT EXISTS(SELECT 1 FROM execution_transaction WHERE chain_id = $1 AND transaction_hash = $2)\")\n    .bind(chain_id).bind(&tx_hash).fetch_one(&pool).await?;\nif !exists { skip_or_insert(); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always insert the execution transaction row before issuing status updates","Track hashes only from the same chain/database they were persisted to","Coordinate retention/cleanup jobs with in-flight status updates"],"tags":["database","rust","sqlx","update-no-row"],"backgroundTag":"resource-not-found","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"}