{"record":{"id":"d289aaff7ad30441","repo":"nautechsystems/nautilus_trader","slug":"failed-to-read-verification-schema-version-e","errorCode":null,"errorMessage":"Failed to read verification schema version: {e}","messagePattern":"Failed to read verification schema version: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3997,"sourceCode":"        }\n\n        sqlx::query(\n            \"LOCK TABLE execution_intent, execution_transaction_hash, \\\n             execution_verification_nonce, execution_verified_finalized_header, \\\n             execution_verification_decision, execution_replacement_scan \\\n             IN ACCESS EXCLUSIVE MODE\",\n        )\n        .execute(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to lock execution verification state: {e}\"))?;\n\n        let installed_version = sqlx::query_scalar::<_, i16>(\n            \"SELECT version FROM execution_schema_version \\\n             WHERE component = 'evm_execution_verification'\",\n        )\n        .fetch_optional(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to read verification schema version: {e}\"))?;\n        if let Some(installed_version) = installed_version {\n            anyhow::ensure!(\n                installed_version <= VERIFICATION_SCHEMA_VERSION,\n                \"Execution verification schema version {installed_version} is newer than supported version {VERIFICATION_SCHEMA_VERSION}\"\n            );\n        }\n\n        let current = sqlx::query_as::<_, (String, String, i64, i64)>(\n            \"\n            SELECT manifest_version, manifest_digest, next_canonical_nonce, revision\n            FROM execution_verification_nonce\n            WHERE chain_id = $1 AND wallet_address = $2\n            FOR UPDATE\n            \",\n        )\n        .bind(chain_id)\n        .bind(bootstrap.wallet_address)\n        .fetch_optional(&mut *transaction)","sourceCodeStart":3979,"sourceCodeEnd":4015,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L3979-L4015","documentation":"After locking the verification tables, bootstrap reads the installed schema version from execution_schema_version for component 'evm_execution_verification'. This error wraps any database failure of that SELECT (connection error, missing table, permissions), as opposed to the version being merely absent or too new.","triggerScenarios":"The SELECT version FROM execution_schema_version WHERE component='evm_execution_verification' query fails: table does not exist (base schema not installed), connection dropped, insufficient privileges, or a transient Postgres error.","commonSituations":"Running verification bootstrap against a database where only a partial/older schema exists; revoked SELECT grants; transient DB restarts or failover during startup.","solutions":["Ensure the base schema including execution_schema_version was installed before this bootstrap runs","Check the DB user has SELECT on execution_schema_version","Retry on transient connection errors","Inspect the inner sqlx error for the precise cause (undefined_table vs connection error)"],"exampleFix":"// before: assuming schema exists\nbootstrap_verification(pool).await?;\n// after: install base schema first\nensure_base_schema(pool).await?; // creates execution_schema_version if missing\nbootstrap_verification(pool).await?;","handlingStrategy":"validation","validationCode":"let exists: Option<i16> = sqlx::query_scalar(\n  \"SELECT 1 FROM information_schema.tables\n   WHERE table_name='execution_schema_version'\")\n  .fetch_optional(&mut *conn).await?;\nif exists.is_none() { install_base_schema(&mut conn).await?; }","typeGuard":null,"tryCatchPattern":"match read_schema_version(&mut tx).await {\n    Err(e) if is_transient_db_error(&e) => retry_with_backoff(3, || read_schema_version(&mut tx)),\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Always run the base schema installer before the verification bootstrap","Grant the app role SELECT on execution_schema_version","Health-check the DB connection at startup before bootstrap","Use environment-pinned database URLs to avoid hitting the wrong database"],"tags":["database","postgres","schema","sql"],"backgroundTag":"database-query-failed","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"}