{"record":{"id":"665ba6fa457f03c9","repo":"nautechsystems/nautilus_trader","slug":"pool-state-at-block-has-an-invalid-partial-snap","errorCode":null,"errorMessage":"Pool state at block {} has an invalid partial snapshot watermark","messagePattern":"Pool state at block (.+?) has an invalid partial snapshot watermark","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":3967,"sourceCode":"        verification.verify_decision_header(now_unix_secs).await,\n        \"swap decision header\",\n    )?;\n    validate_quote_age(position.number, head.number, max_age_blocks)?;\n    let canonical_block = verified_value(\n        verification.verify_block(position.number).await,\n        \"profiler watermark header\",\n    )?;\n    anyhow::ensure!(\n        canonical_block.hash == expected_block_hash,\n        \"Pool state block {} changed from {} to {}; refresh the profiler before execution\",\n        position.number,\n        expected_block_hash,\n        canonical_block.hash\n    );\n\n    let snapshot_transaction = position.transaction_index == BLOCK_SCOPED_SNAPSHOT_INDEX;\n    let snapshot_log = position.log_index == BLOCK_SCOPED_SNAPSHOT_INDEX;\n    anyhow::ensure!(\n        snapshot_transaction == snapshot_log,\n        \"Pool state at block {} has an invalid partial snapshot watermark\",\n        position.number\n    );\n\n    if snapshot_transaction {\n        let snapshot_hash = B256::from_str(&position.transaction_hash)\n            .with_context(|| \"Invalid block-scoped snapshot hash\")?;\n        anyhow::ensure!(\n            snapshot_hash == expected_block_hash,\n            \"Block-scoped snapshot hash {snapshot_hash} does not match ingestion hash {expected_block_hash}\"\n        );\n    } else {\n        validate_profiler_event_verified(\n            position,\n            expected_block_hash,\n            plan.pool_address,\n            &plan.pool,","sourceCodeStart":3949,"sourceCodeEnd":3985,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L3949-L3985","documentation":"Block-scoped snapshots are recorded as a single watermark where transaction_index and log_index must both equal the sentinel BLOCK_SCOPED_SNAPSHOT_INDEX. If exactly one of them matches, the snapshot row is only partially written or corrupted, and the library cannot tell whether the event is a snapshot marker or a normal event. It rejects the row as invalid.","triggerScenarios":"During quote validation, position.transaction_index == BLOCK_SCOPED_SNAPSHOT_INDEX differs in truth from position.log_index == BLOCK_SCOPED_SNAPSHOT_INDEX for the pool-state row.","commonSituations":"A partially applied update that set one sentinel field but not the other; a buggy indexer writing snapshot markers; manual DB edits; schema migration that changed the sentinel encoding for one column only.","solutions":["Re-ingest the snapshot for that block so both transaction_index and log_index are set (or unset) consistently.","Fix the indexer/writer to set both sentinel fields atomically.","Check for in-progress writes or migrations touching that row and re-run them.","If the row should be a normal event, clear both sentinel fields."],"exampleFix":"// before: partially set sentinel\nposition.transaction_index = BLOCK_SCOPED_SNAPSHOT_INDEX;\n\n// after: set both atomically\nposition.transaction_index = BLOCK_SCOPED_SNAPSHOT_INDEX;\nposition.log_index = BLOCK_SCOPED_SNAPSHOT_INDEX;","handlingStrategy":"validation","validationCode":"let snap_tx = position.transaction_index == BLOCK_SCOPED_SNAPSHOT_INDEX;\nlet snap_log = position.log_index == BLOCK_SCOPED_SNAPSHOT_INDEX;\nif snap_tx != snap_log {\n    anyhow::bail!(\"partial snapshot watermark at block {}\", position.number);\n}","typeGuard":"fn is_consistent_snapshot_marker(position: &PoolStatePosition) -> bool {\n    (position.transaction_index == BLOCK_SCOPED_SNAPSHOT_INDEX)\n        == (position.log_index == BLOCK_SCOPED_SNAPSHOT_INDEX)\n}","tryCatchPattern":null,"preventionTips":["Write both sentinel fields together in one statement/transaction.","Validate snapshot rows at ingest time before persisting.","Flag partially-set sentinel rows with a data-integrity check."],"tags":["data-corruption","invariant-violation","profiler"],"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"}