{"record":{"id":"507296bebed299bf","repo":"nautechsystems/nautilus_trader","slug":"execution-payload-storage-is-not-migrating","errorCode":null,"errorMessage":"Execution payload storage is {}, not migrating","messagePattern":"Execution payload storage is (.+?), not migrating","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":4915,"sourceCode":"            \"Execution payload batch size must be positive\"\n        );\n        let mut transaction = self\n            .pool\n            .begin()\n            .await\n            .context(\"failed to start execution payload migration batch\")?;\n        lock_execution_payload_operation(&mut transaction).await?;\n        let state_row = sqlx::query(\n            \"SELECT deployment_id, protocol_version, operation, active_key_id \\\n             FROM execution_payload_state WHERE component = 'signed_transactions' FOR UPDATE\",\n        )\n        .fetch_optional(&mut *transaction)\n        .await\n        .context(\"failed to lock execution payload migration state\")?\n        .ok_or_else(|| anyhow::anyhow!(\"Execution payload migration state is missing\"))?;\n        let state = execution_payload_state_from_row(&state_row)?;\n        validate_execution_payload_state(&state, keys)?;\n        anyhow::ensure!(\n            state.operation == \"migrate\",\n            \"Execution payload storage is {}, not migrating\",\n            state.operation\n        );\n\n        let rows = sqlx::query_as::<_, ExecutionTransactionHashRow>(\n            \"\n            SELECT\n                id, intent_id, chain_id, transaction_hash, payload_expected,\n                raw_transaction, sealed_transaction, status, block_number, block_hash,\n                receipt_success, gas_used, effective_gas_price, current\n            FROM execution_transaction_hash\n            WHERE payload_expected AND raw_transaction IS NOT NULL\n            ORDER BY id\n            LIMIT $1\n            FOR UPDATE\n            \",\n        )","sourceCodeStart":4897,"sourceCodeEnd":4933,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L4897-L4933","documentation":"Migration batches are only valid while execution_payload_state.operation == 'migrate'. If the state records any other operation (e.g. 'ready' or an activation step), the driver refuses to run migration work, preventing migration logic from executing outside its sanctioned lifecycle phase.","triggerScenarios":"Calling migrate_execution_payload_batch when the state row exists and validates but operation != 'migrate' — e.g. storage is already fully migrated ('ready') or is in another maintenance phase.","commonSituations":"Re-running migration tooling after migration already completed; another operator switched the operation column; activation still in progress when the migrator started.","solutions":["If the store is already 'ready', migration is done — stop re-running the migrator","If it is in another maintenance phase, complete or abort that phase first, then enter migration properly via the library's lifecycle API","Inspect SELECT operation FROM execution_payload_state WHERE component='signed_transactions' to see the current phase","Only drive operation transitions through the library's activate/migrate/complete functions"],"exampleFix":"// before: unconditional migration\nwhile db.migrate_execution_payload_batch(&keys, 500).await? {}\n// after: only migrate when in migrate phase\nif db.execution_payload_state().await?.map(|s| s.operation).as_deref() == Some(\"migrate\") {\n    while db.migrate_execution_payload_batch(&keys, 500).await? {}\n}","handlingStrategy":"validation","validationCode":"let op: Option<String> = sqlx::query_scalar(\n    \"SELECT operation FROM execution_payload_state WHERE component = 'signed_transactions'\",\n).fetch_optional(&pool).await?;\nlet can_migrate = op.as_deref() == Some(\"migrate\");","typeGuard":"fn is_migrating(op: &str) -> bool { op == \"migrate\" }","tryCatchPattern":"match db.migrate_execution_payload_batch(&keys, 500).await {\n    Ok(_) => {}\n    Err(e) if e.to_string().contains(\"not migrating\") => {\n        // storage already ready or in another phase; stop or re-enter lifecycle correctly\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check the operation column before launching migration tooling","Treat 'ready' as terminal — do not re-run migrations after completion","Drive operation transitions only through library APIs","Avoid multiple concurrent operators changing the operation column"],"tags":["database","migration","lifecycle"],"backgroundTag":"invalid-state-transition","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}