{"record":{"id":"2c03433f5844605f","repo":"nautechsystems/nautilus_trader","slug":"failed-to-read-execution-schema-version-e","errorCode":null,"errorMessage":"Failed to read execution schema version: {e}","messagePattern":"Failed to read execution schema version: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3228,"sourceCode":"                )),\n                UNIQUE (intent_id, transition_key)\n            )\n            \",\n        ] {\n            sqlx::query(statement)\n                .execute(&mut *transaction)\n                .await\n                .map_err(|e| {\n                    anyhow::anyhow!(\"Failed to migrate execution_transaction table: {e}\")\n                })?;\n        }\n\n        let installed_version = sqlx::query_scalar::<_, i16>(\n            \"SELECT version FROM execution_schema_version WHERE component = 'evm_execution'\",\n        )\n        .fetch_optional(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to read execution schema version: {e}\"))?;\n        if let Some(installed_version) = installed_version\n            && installed_version > EXECUTION_SCHEMA_VERSION\n        {\n            anyhow::bail!(\n                \"Execution schema version {} is newer than supported version {EXECUTION_SCHEMA_VERSION}\",\n                installed_version\n            );\n        }\n\n        let unresolved_legacy = sqlx::query_scalar::<_, i64>(\n            \"\n            SELECT COUNT(*)\n            FROM execution_transaction\n            WHERE status IN ('pending', 'included', 'reverted')\n            \",\n        )\n        .fetch_one(&mut *transaction)\n        .await","sourceCodeStart":3210,"sourceCodeEnd":3246,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/cache/database.rs#L3210-L3246","documentation":"Thrown when the SELECT of version for component 'evm_execution' from execution_schema_version fails inside ensure_execution_transaction_schema, immediately after the DDL loop. Because that table was just created with IF NOT EXISTS in the same transaction, this almost always indicates a transport-level failure (dropped connection, statement timeout) rather than a missing relation.","triggerScenarios":"Connection reset between the DDL loop and the version read; statement_timeout firing on the migration session; a pooling proxy killing the session mid-transaction.","commonSituations":"Flaky network path to a managed Postgres; aggressive statement_timeout; failover during migration.","solutions":["Confirm network stability to Postgres and re-run - the whole migration is idempotent (IF NOT EXISTS / ON CONFLICT / OR REPLACE)","Raise statement_timeout for the migration session","If a proxy like PgBouncer sits in the path, run the migration over a direct or session-pooled connection"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Health check immediately before the migration to reduce mid-flight transport failures\nlet healthy = sqlx::query(\"SELECT 1\").execute(&pool).await.is_ok();","typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match db.ensure_execution_transaction_schema().await {\n        Ok(()) => break,\n        Err(e) if e.downcast_ref::<sqlx::Error>().is_some_and(|se| matches!(se, sqlx::Error::Io(_) | sqlx::Error::ConnectionClosed(_))) => {\n            tokio::time::sleep(Duration::from_secs(1u64 << attempt)).await;\n        }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Run the migration over a stable direct connection, not through transaction-pooling proxies","Raise statement_timeout for the migration session","Keep migration windows away from scheduled failovers or maintenance"],"tags":["rust","sqlx","postgresql","query-failed","migration"],"backgroundTag":"database-query-failed","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}