{"record":{"id":"bad09c64131d7292","repo":"nautechsystems/nautilus_trader","slug":"execution-payload-rollback-batch-size-must-be-posi","errorCode":null,"errorMessage":"Execution payload rollback batch size must be positive","messagePattern":"Execution payload rollback batch size must be positive","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":5549,"sourceCode":"            )\n            .bind(hash.id)\n            .execute(&mut *transaction)\n            .await\n            .context(\"failed to record execution payload rewrap progress\")?;\n        }\n        transaction\n            .commit()\n            .await\n            .context(\"failed to commit execution payload rewrap batch\")?;\n        Ok(false)\n    }\n\n    pub(crate) async fn rollback_execution_payload_storage(\n        &self,\n        keys: &PayloadKeySet,\n        batch_size: i64,\n    ) -> anyhow::Result<()> {\n        anyhow::ensure!(\n            batch_size > 0,\n            \"Execution payload rollback batch size must be positive\"\n        );\n        self.begin_execution_payload_rollback(keys).await?;\n\n        loop {\n            if self\n                .rollback_execution_payload_batch(keys, batch_size)\n                .await?\n            {\n                return Ok(());\n            }\n        }\n    }\n\n    async fn begin_execution_payload_rollback(&self, keys: &PayloadKeySet) -> anyhow::Result<()> {\n        let mut transaction = self\n            .pool","sourceCodeStart":5531,"sourceCodeEnd":5567,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L5531-L5567","documentation":"rollback_execution_payload_storage processes stored execution payloads in batches and requires a strictly positive batch_size (i64). This error is thrown before any rollback work begins when batch_size <= 0, preventing an infinite loop or no-op batch query.","triggerScenarios":"Calling rollback_execution_payload_storage with batch_size = 0 or a negative value, e.g. from configuration where the batch size defaulted to 0 or was parsed incorrectly (missing/failed i64 parse leaving 0).","commonSituations":"A config file with rollback_batch_size: 0; a CLI/env value that failed parsing and defaulted to 0; copy-pasted invocation from another rollback helper that takes a limit rather than a batch size.","solutions":["Pass a positive batch size (e.g. 500) when calling rollback_execution_payload_storage","Fix the configuration source so rollback_batch_size is set and parsed as a positive integer","Validate/clamp the value at config load time (ensure!(v > 0)) before reaching the storage layer"],"exampleFix":"// before\ndb.rollback_execution_payload_storage(&keys, config.rollback_batch_size).await?; // 0\n// after\nlet batch = config.rollback_batch_size.max(1);\ndb.rollback_execution_payload_storage(&keys, batch).await?;","handlingStrategy":"validation","validationCode":"let batch_size: i64 = config.rollback_batch_size;\nif batch_size <= 0 {\n    return Err(anyhow!(\"rollback_batch_size must be positive, got {batch_size}\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate batch-size config at load time (positive integer)","Avoid silent 0 defaults for numeric CLI/env options","Write an integration test invoking rollback with configured batch size"],"tags":["rust","validation","arguments","rollback"],"backgroundTag":"invalid-argument-value","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"}