{"record":{"id":"c6693c843e348452","repo":"nautechsystems/nautilus_trader","slug":"execution-schema-version-is-newer-than-supporte","errorCode":null,"errorMessage":"Execution schema version {} is newer than supported version {EXECUTION_SCHEMA_VERSION}","messagePattern":"Execution schema version (.+?) is newer than supported version (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3600,"sourceCode":"        ] {\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\n        .map_err(|e| anyhow::anyhow!(\"Failed to inspect legacy execution transactions: {e}\"))?;\n        anyhow::ensure!(\n            unresolved_legacy == 0,\n            \"Cannot safely migrate {unresolved_legacy} unresolved execution schema version 1 transaction(s); resolve them with the prior version before enabling version {EXECUTION_SCHEMA_VERSION}\"","sourceCodeStart":3582,"sourceCodeEnd":3618,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L3582-L3618","documentation":"The blockchain adapter's execution cache database stores a schema version; on open, if the on-disk execution schema version is greater than EXECUTION_SCHEMA_VERSION compiled into this binary, opening is aborted. Downgrading the library (running an older binary against a database written by a newer one) would risk misreading or corrupting the schema.","triggerScenarios":"Opening the blockchain execution cache database (database.rs execution open path) after switching from a newer version of nautilus_blockchain back to an older one, so installed_version > EXECUTION_SCHEMA_VERSION.","commonSituations":"Rolling back a deployment or checking out an older git branch while the SQLite/DB file was migrated by a newer build; sharing one cache file across machines with different library versions; restoring a backup created by newer software.","solutions":["Upgrade the library back to the version (or newer) that wrote the database so its schema version is supported","Move/rename the existing cache database file so a fresh one is created at the old schema version (loses cached data)","If the data is dispensable, delete the cache database and let it rebuild from the chain","Check the installed version row in the database to confirm which version created it before deciding"],"exampleFix":"// before: opening old binary against migrated DB\nlet db = ExecutionDatabase::open(path).await?; // bails: schema too new\n// after: detect and start fresh\nmatch ExecutionDatabase::open(path).await {\n    Ok(db) => db,\n    Err(e) if e.to_string().contains(\"newer than supported\") => {\n        fs::rename(path, path.with_extension(\"db.newer-schema\"))?;\n        ExecutionDatabase::open(path).await?\n    }\n    Err(e) => return Err(e),\n}","handlingStrategy":"try-catch","validationCode":"fn is_schema_too_new(err: &anyhow::Error) -> bool {\n    err.to_string().contains(\"newer than supported version\")\n}\n// check before opening: if cache file exists and was written by a newer build, relocate it first","typeGuard":null,"tryCatchPattern":"let db = match ExecutionDatabase::open(path).await {\n    Ok(db) => db,\n    Err(e) if e.to_string().contains(\"newer than supported version\") => {\n        warn!(\"cache written by newer build; recreating at old schema\");\n        std::fs::rename(&path, path.with_extension(\"db.incompatible\"))?;\n        ExecutionDatabase::open(path).await?\n    }\n    Err(e) => return Err(e.into()),\n};","preventionTips":["Pin one library version per cache database location; don't share cache files across versions","When rolling back versions, relocate or delete the cache DB first","Back up cache files with the creating version in the filename","Read the schema-version row before opening if you need to detect version mismatches proactively"],"tags":["rust","blockchain","database","schema","versioning"],"backgroundTag":"incompatible-source-type","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"}