{"record":{"id":"b1595b9ff783eb85","repo":"tursodatabase/turso","slug":"queries-per-transaction-must-be-positive","errorCode":null,"errorMessage":"queries per transaction must be positive","messagePattern":"queries per transaction must be positive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"perf/memory/src/fts.rs","lineNumber":282,"sourceCode":"        result\n    }\n}\n\nimpl FtsConfig {\n    pub fn validate(&self) -> Result<()> {\n        ensure!(self.documents > 0, \"documents must be positive\");\n        ensure!(\n            self.corpus\n                .cache_pages\n                .is_none_or(|pages| (200..=i32::MAX as usize).contains(&pages)),\n            \"cache pages must be between 200 and i32::MAX\"\n        );\n        ensure!(self.connections > 0, \"connections must be positive\");\n        ensure!(\n            self.execution.batches() > 0,\n            \"queries or transactions must be positive\"\n        );\n        ensure!(\n            self.execution.queries_per_batch() > 0,\n            \"queries per transaction must be positive\"\n        );\n        ensure!(\n            !matches!(self.state, QueryState::First)\n                || (self.execution.batches() == 1 && self.execution.queries_per_batch() == 1),\n            \"first-query runs require one query per connection; use warm for repeated transactions\"\n        );\n        self.execution\n            .batches()\n            .checked_mul(self.execution.queries_per_batch())\n            .and_then(|n| n.checked_mul(self.connections))\n            .ok_or_else(|| anyhow::anyhow!(\"total query count overflows usize\"))?;\n        Ok(())\n    }\n}\n\nimpl Execution {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/perf/memory/src/fts.rs#L264-L300","documentation":"Validation guard in FtsConfig::validate (called from prepare/main of the memory benchmark's FTS workload): the FTS configuration is checked before the benchmark runs, and the supplied configuration has documents <= 0, connections <= 0, or queries-per-transaction (execution batches) <= 0. This specific message fires when execution.batches() — the number of queries divided by transactions — is zero or negative, i.e. either queries or transactions is zero, so no measurable work would be performed.","triggerScenarios":"Configuring a transactional run where execution.queries_per_batch() computes to 0 — e.g. queries_per_transaction set to 0 or derived from a zero division/default.","commonSituations":"--queries-per-transaction 0 on the command line; programmatic Execution built with a zero field; config template with a placeholder never filled in.","solutions":["Set queries per transaction to a positive value, e.g. --queries-per-transaction 10","Default the value to 1 when unset before constructing FtsConfig","Check how queries_per_batch() is derived if it is computed from other fields"],"exampleFix":"// before\nExecution { queries_per_transaction: 0, .. }\n// after\nExecution { queries_per_transaction: 10, .. }","handlingStrategy":"validation","validationCode":"if queries_per_transaction == 0 { return Err(anyhow!(\"queries per transaction must be > 0\")); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = config.validate() {\n    if e.to_string().contains(\"queries per transaction\") {\n        // default the field to 1 and rebuild\n    }\n}","preventionTips":["Fill config template placeholders before running","Use .max(1) on any computed per-transaction value","Validate all Execution fields together before constructing FtsConfig"],"tags":["configuration","validation","benchmark","workload"],"backgroundTag":"invalid-argument-value","analyzedSha":"492c4a71cd7c2649e7df83da1471b74f4b1c7aa9","analyzedAt":"2026-09-13T18:13:59.796Z","contentChangedAt":"2026-09-13T18:13:59.796Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}