{"record":{"id":"b9c1fafbdab9669c","repo":"tursodatabase/turso","slug":"queries-or-transactions-must-be-positive","errorCode":null,"errorMessage":"queries or transactions must be positive","messagePattern":"queries or transactions must be positive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"perf/memory/src/fts.rs","lineNumber":278,"sourceCode":"        .await;\n        if result.is_err() {\n            workers.shutdown().await;\n        }\n        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(())","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/perf/memory/src/fts.rs#L260-L296","documentation":"FtsConfig::validate() computes execution.batches() (derived from queries and transactions settings) and requires it to be positive. If neither queries nor transactions are configured, there is no work to execute per batch, so the config is rejected.","triggerScenarios":"Creating FtsConfig where both the queries list/count and the transactions flag are zero/absent, making execution.batches() == 0.","commonSituations":"Running the benchmark without specifying any query workload or --transactions; an empty query list in a config file; flags accidentally filtered out by a script.","solutions":["Provide at least one query for the benchmark to run","Enable the transactions option so transactional batches are executed","Check that your config file/script actually passes the workload flags"],"exampleFix":"// before\nFtsConfig { execution: Execution { queries: vec![], transactions: false, .. } }\n// after\nFtsConfig { execution: Execution { queries: vec![\"SELECT * FROM fts WHERE body MATCH 'token'\".into()], transactions: false, .. } }","handlingStrategy":"validation","validationCode":"if execution.queries.is_empty() && !execution.transactions {\n    return Err(anyhow!(\"provide queries or enable transactions\"));\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = config.validate() {\n    if e.to_string().contains(\"queries or transactions must be positive\") {\n        // add a default query workload or enable transactions\n    }\n}","preventionTips":["Always ship a default query list in config templates","Check that scripts actually forward workload flags","Validate config file contents after loading, before use"],"tags":["configuration","validation","benchmark","workload"],"backgroundTag":"missing-required-config-field","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"}