tursodatabase/turso · error

need at least one query per connection

Error message

need at least one query per connection

What it means

In search-benchmark mode, the total number of queries is distributed across --connections worker connections. ensure! at perf/fts/src/main.rs:82 requires queries >= connections so every connection executes at least one query; otherwise some connections would idle and the per-connection workload would be ill-defined.

Solutions

  1. Increase --queries to at least --connections
  2. Reduce --connections to be at most --queries
  3. Omit --queries to use the default (connections for --state first, 10000 otherwise)

Example fix

// before
fts-bench --connections 16 --queries 8
// after
fts-bench --connections 16 --queries 16
Defensive patterns

Strategy: validation

Validate before calling

if queries < connections { panic!("--queries must be >= --connections ({queries} < {connections})"); }

Prevention

When it happens

Trigger: Running with an explicitly low --queries value smaller than --connections, e.g. `fts-bench --connections 8 --queries 4`. Also happens when the default query count (connections for first-query state, otherwise 10000) is overridden below the connection count.

Common situations: Smoke-testing with tiny --queries values while leaving the default or high --connections count; scaling connections up without scaling queries; CI scripts with fixed small query counts.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of tursodatabase/turso@8d4a589f8d (2026-09-20). Data as JSON: /api/errors/b1d612e24b381425. Report an issue: GitHub.

Appendix: source

Thrown at perf/fts/src/main.rs:82

    };
    runtime.block_on(run(args))
}

async fn run(mut args: Args) -> Result<()> {
    let (query_limit, min_seconds) = match args.benchmark {
        Benchmark::Search => {
            ensure!(
                args.seconds.is_none(),
                "--seconds requires --benchmark throughput"
            );
            let queries = args
                .queries
                .unwrap_or(if matches!(args.state, QueryState::First) {
                    args.connections
                } else {
                    10_000
                });
            ensure!(
                queries >= args.connections,
                "need at least one query per connection"
            );
            ensure!(
                !matches!(args.state, QueryState::First) || queries == args.connections,
                "first-query latency requires one query per connection"
            );
            (queries, 0.0)
        }
        Benchmark::Throughput => {
            ensure!(
                args.queries.is_none(),
                "--queries requires --benchmark search"
            );
            ensure!(
                matches!(args.state, QueryState::Warm),
                "throughput requires --state warm"
            );

View on GitHub (pinned to 8d4a589f8d)