tursodatabase/turso · error

queries or transactions must be positive

Error message

queries or transactions must be positive

What it means

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.

Source

Thrown at perf/memory/src/fts.rs:278

        .await;
        if result.is_err() {
            workers.shutdown().await;
        }
        result
    }
}

impl FtsConfig {
    pub fn validate(&self) -> Result<()> {
        ensure!(self.documents > 0, "documents must be positive");
        ensure!(
            self.corpus
                .cache_pages
                .is_none_or(|pages| (200..=i32::MAX as usize).contains(&pages)),
            "cache pages must be between 200 and i32::MAX"
        );
        ensure!(self.connections > 0, "connections must be positive");
        ensure!(
            self.execution.batches() > 0,
            "queries or transactions must be positive"
        );
        ensure!(
            self.execution.queries_per_batch() > 0,
            "queries per transaction must be positive"
        );
        ensure!(
            !matches!(self.state, QueryState::First)
                || (self.execution.batches() == 1 && self.execution.queries_per_batch() == 1),
            "first-query runs require one query per connection; use warm for repeated transactions"
        );
        self.execution
            .batches()
            .checked_mul(self.execution.queries_per_batch())
            .and_then(|n| n.checked_mul(self.connections))
            .ok_or_else(|| anyhow::anyhow!("total query count overflows usize"))?;
        Ok(())

View on GitHub (pinned to 492c4a71cd)

Solutions

  1. Provide at least one query for the benchmark to run
  2. Enable the transactions option so transactional batches are executed
  3. Check that your config file/script actually passes the workload flags

Example fix

// before
FtsConfig { execution: Execution { queries: vec![], transactions: false, .. } }
// after
FtsConfig { execution: Execution { queries: vec!["SELECT * FROM fts WHERE body MATCH 'token'".into()], transactions: false, .. } }
Defensive patterns

Strategy: validation

Validate before calling

if execution.queries.is_empty() && !execution.transactions {
    return Err(anyhow!("provide queries or enable transactions"));
}

Try / catch

if let Err(e) = config.validate() {
    if e.to_string().contains("queries or transactions must be positive") {
        // add a default query workload or enable transactions
    }
}

Prevention

When it happens

Trigger: Creating FtsConfig where both the queries list/count and the transactions flag are zero/absent, making execution.batches() == 0.

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13). Data as JSON: /api/errors/b9c1fafbdab9669c. Report an issue: GitHub.