tursodatabase/turso · error

runs must be positive

Error message

runs must be positive

What it means

The FTS benchmark CLI validates its arguments after parsing and rejects a non-positive `--runs` value. Running zero or negative repetitions is meaningless for benchmark aggregation, so main exits immediately with this message.

Solutions

  1. Re-run with `--runs` set to a positive integer (e.g. `--runs 10`).
  2. Fix the script/variable producing the run count so it is >= 1.
  3. Add a clap value_parser range constraint so the error surfaces at parse time.

Example fix

// before
perf-fts --runs 0
// after
perf-fts --runs 10
Defensive patterns

Strategy: validation

Validate before calling

if runs <= 0 { eprintln!("--runs must be a positive integer"); std::process::exit(2); }

Prevention

When it happens

Trigger: Invoking the perf/fts binary with `--runs 0` or a negative value on the command line.

Common situations: Scripting the benchmark with a computed run count that resolved to 0, or copying a CLI example and leaving a placeholder value.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

    )]
    targets: Vec<Target>,
    #[arg(long, default_value_t = 1)]
    connections: usize,
    #[arg(
        long,
        value_enum,
        value_delimiter = ',',
        default_value = "rare,common,and,or,phrase,ranked"
    )]
    cases: Vec<QueryCase>,
    #[cfg(all(feature = "flamegraph", any(target_os = "linux", target_os = "macos")))]
    #[arg(long)]
    flamegraph: Option<std::path::PathBuf>,
}

fn main() -> Result<()> {
    let args = Args::parse();
    ensure!(args.runs > 0, "runs must be positive");
    ensure!(args.connections > 0, "connections must be positive");
    eprintln!("bundled SQLite version: {}", rusqlite::version());
    let runtime = match args.benchmark {
        Benchmark::Search => tokio::runtime::Builder::new_current_thread()
            .enable_all()
            .build()?,
        Benchmark::Throughput => tokio::runtime::Builder::new_multi_thread()
            .worker_threads(args.connections)
            .max_blocking_threads(args.connections)
            .enable_all()
            .build()?,
    };
    runtime.block_on(run(args))
}

async fn run(mut args: Args) -> Result<()> {
    let (query_limit, min_seconds) = match args.benchmark {
        Benchmark::Search => {

View on GitHub (pinned to 8d4a589f8d)