{"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":3300,"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    /// Reserves durable ownership of a signer slot and optional client order before signing.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the signer or client order is already owned, or persistence fails.\n    pub async fn reserve_execution_intent(\n        &self,\n        intent: &ExecutionIntentInsert,\n    ) -> anyhow::Result<ExecutionIntentRow> {\n        let chain_id = i32::try_from(intent.chain_id)\n            .with_context(|| format!(\"Chain ID {} exceeds PostgreSQL INTEGER\", intent.chain_id))?;\n        let created_block = i64::try_from(intent.created_block).with_context(|| {\n            format!(\n                \"Execution creation block {} exceeds PostgreSQL BIGINT\",","sourceCodeStart":3282,"sourceCodeEnd":3318,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/cache/database.rs#L3282-L3318","documentation":"Thrown when the final COMMIT of the schema-v2 migration transaction fails in ensure_execution_transaction_schema. The exclusive lock, all DDL, and the version upsert roll back, leaving the database at v1. Causes are transport-level: connection dropped at commit, Postgres restart or failover, or a proxy killing the session.","triggerScenarios":"Connection reset after the DDL ran but before COMMIT; Postgres crash or failover mid-migration; idle_in_transaction_session_timeout expiring during a long migration.","commonSituations":"Unstable links to managed databases; long migrations on big tables colliding with idle timeouts; transaction-pooling proxies in the path.","solutions":["Re-run the migration - every statement is idempotent and the failed commit left the schema at v1","Raise idle_in_transaction_session_timeout above the expected migration duration","Run migrations over a direct connection rather than a transaction-pooling proxy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match db.ensure_execution_transaction_schema().await {\n    Err(e) if e.downcast_ref::<sqlx::Error>().is_some_and(|se| matches!(se, sqlx::Error::Io(_) | sqlx::Error::ConnectionClosed(_))) => {\n        // commit failed: schema rolled back to v1; re-run the idempotent migration after connectivity returns\n    }\n    other => other?,\n}","preventionTips":["Set idle_in_transaction_session_timeout above the worst-case migration duration","Use a direct connection for migrations instead of a transaction-pooling proxy","Verify the installed version (SELECT version FROM execution_schema_version WHERE component = 'evm_execution') after migration to confirm activation"],"tags":["rust","sqlx","postgresql","commit-failed","transaction","migration"],"backgroundTag":"database-commit-failed","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}