{"record":{"id":"6ce57d9c96b10fc1","repo":"nautechsystems/nautilus_trader","slug":"failed-to-commit-execution-schema-migration-e","errorCode":null,"errorMessage":"Failed to commit execution schema migration: {e}","messagePattern":"Failed to commit execution schema migration: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3668,"sourceCode":"            \"\n            INSERT INTO execution_schema_version (component, version)\n            VALUES ('evm_execution', 2)\n            ON CONFLICT (component) DO UPDATE SET version = EXCLUDED.version\n            WHERE execution_schema_version.version <= EXCLUDED.version\n            \",\n        ] {\n            sqlx::query(statement)\n                .execute(&mut *transaction)\n                .await\n                .map_err(|e| {\n                    anyhow::anyhow!(\"Failed to activate execution schema version 2: {e}\")\n                })?;\n        }\n\n        transaction\n            .commit()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to commit execution schema migration: {e}\"))?;\n\n        Ok(())\n    }\n\n    /// Loads the durable finalized-header and nonce position when verification is active.\n    pub(crate) async fn load_execution_verification_position(\n        &self,\n        chain_id: u32,\n        wallet_address: &str,\n        manifest_version: &str,\n        manifest_digest: &str,\n    ) -> anyhow::Result<Option<ExecutionVerificationPosition>> {\n        let installed = sqlx::query_scalar::<_, i16>(\n            \"SELECT version FROM execution_schema_version \\\n             WHERE component = 'evm_execution_verification'\",\n        )\n        .fetch_optional(&self.pool)\n        .await","sourceCodeStart":3650,"sourceCodeEnd":3686,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L3650-L3686","documentation":"Wrapped error from database.rs:3668 raised when committing the execution schema migration transaction fails. All v2 activation DDL executed successfully but PostgreSQL refused the COMMIT, leaving the migration unapplied (transactional rollback semantics apply).","triggerScenarios":"Calling transaction.commit() at the end of the v2 migration when the connection to PostgreSQL has been lost, the transaction was already aborted, the transaction is idle-in-transaction timeout-killed, or the database is in read-only/recovery mode.","commonSituations":"Long-running migration exceeds idle_in_transaction_session_timeout; network interruption between the last DDL and commit; database failover or maintenance restart during the migration window; running against a hot-standby replica.","solutions":["Re-run the migration; nothing was committed, so it is safe to retry from scratch.","Increase idle_in_transaction_session_timeout or network keepalives if long DDL batches cause disconnects.","Check PostgreSQL server logs for the commit-time failure reason (connection reset, serialization, read-only).","Run the migration against the primary node, not a replica, and during a quiet maintenance window."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"-- preflight: writable primary, sane timeout\nSHOW transaction_read_only;              -- must be off\nSHOW idle_in_transaction_session_timeout; -- ample for the DDL batch","typeGuard":null,"tryCatchPattern":"loop {\n    match migrate_execution_schema(&pool).await {\n        Ok(()) => break,\n        Err(e) if e.to_string().contains(\"Failed to commit execution schema migration\") => {\n            backoff::sleep().await; // safe: nothing was committed\n        },\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Run migrations in a maintenance window with a stable connection","Raise idle_in_transaction_session_timeout for long DDL batches","Always retry — the commit failure rolled everything back"],"tags":["database","migration","postgresql","commit"],"backgroundTag":"database-write-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}