{"record":{"id":"585c7e0b79d1a657","repo":"nautechsystems/nautilus_trader","slug":"steam-pool-event-transform-error-e","errorCode":null,"errorMessage":"Steam pool event transform error: {e}","messagePattern":"Steam pool event transform error: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3268,"sourceCode":"                .bind(pool_identifier.to_string())\n                .bind(pos.number as i64)\n                .bind(pos.transaction_index as i32)\n                .bind(pos.log_index as i32)\n                .bind(to_block.map(|block| block as i64))\n                .fetch(&self.pool)\n        } else {\n            sqlx::query(QUERY_ALL)\n                .bind(chain.chain_id as i32)\n                .bind(pool_identifier.to_string())\n                .bind(to_block.map(|block| block as i64))\n                .fetch(&self.pool)\n        };\n\n        // Transform rows to events\n        let stream = query.map(move |row_result| match row_result {\n            Ok(row) => {\n                transform_row_to_dex_pool_data(&row, chain.clone(), dex.clone(), instrument_id)\n                    .map_err(|e| anyhow::anyhow!(\"Steam pool event transform error: {e}\"))\n            }\n            Err(e) => Err(anyhow::anyhow!(\"Stream pool events database error: {e}\")),\n        });\n\n        Box::pin(stream)\n    }\n\n    /// Persists an execution transaction record to the `execution_transaction` table.\n    ///\n    /// Records are written before broadcast so a signed transaction is never forgotten;\n    /// the unique `(chain_id, transaction_hash)` constraint makes an exact re-insertion\n    /// idempotent. Signer nonce ownership and order IDs are unique before broadcast. Order\n    /// submission records carry the client order ID; operator transactions (wrap, approve)\n    /// store `NULL`.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the database operation fails.","sourceCodeStart":3250,"sourceCodeEnd":3286,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L3250-L3286","documentation":"This error is produced inside the row-streaming closure when `transform_row_to_dex_pool_data` fails to convert a database row into a DEX pool event. The library maps per-row transform errors into anyhow errors so the stream yields a Result per item; a row that does not match the expected schema shape causes this.","triggerScenarios":"Streaming pool events where a row is missing an expected column, has a value of the wrong type (e.g. malformed numeric/text for parsing), or the transformer's internal parsing (addresses, decimals, instrument ID construction) fails for that row.","commonSituations":"Schema drift between writer and reader versions; rows written by a different chain/dex exporter with unexpected nulls or formats; corrupted or manually edited rows.","solutions":["Log the failing row's contents and inner transform error to find the offending column","Check that the table schema matches the version transform_row_to_dex_pool_data expects","Re-run or repair rows with NULLs or malformed values","Ensure both writer and reader use the same schema version/migrations"],"exampleFix":"// before\n.map_err(|e| anyhow::anyhow!(\"Steam pool event transform error: {e}\"))\n// after\n.map_err(|e| {\n    tracing::warn!(error = %e, \"skipping malformed pool row\");\n    anyhow::anyhow!(\"Steam pool event transform error: {e}\")\n})","handlingStrategy":"validation","validationCode":"// validate expected columns on a sample row before streaming\nlet required = [\"tick_value\", \"liquidity_gross\", \"pool_address\"];\n// after fetching first row, check each column with row.try_get::<_, ...>","typeGuard":null,"tryCatchPattern":"match transform_row_to_dex_pool_data(&row, ...) {\n    Ok(ev) => emit(ev),\n    Err(e) => { tracing::warn!(error = %e, \"row skipped\"); skip(); }\n}","preventionTips":["Keep writer and reader schema versions in lockstep","Add unit tests for transform_row_to_dex_pool_data against real row fixtures","Reject NULLs or malformed values at write time"],"tags":["database","transform","streaming"],"backgroundTag":"schema-validation-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"}