tursodatabase/turso · error
first-query latency requires one query per connection
Error message
first-query latency requires one query per connection
What it means
First-query latency mode measures exactly the first query issued on each connection, so the query budget must equal the connection count. ensure! at perf/fts/src/main.rs:86 rejects --state first combined with a query count that differs from --connections, since extra queries would no longer be first queries.
Solutions
- Set --queries equal to --connections when using --state first
- Omit --queries in first state (the default already equals connections)
- Use --state warm if you want more queries per connection than one
Example fix
// before fts-bench --state first --connections 8 --queries 500 // after fts-bench --state first --connections 8 --queries 8
Defensive patterns
Strategy: validation
Validate before calling
if state == First && queries != connections { panic!("--state first requires --queries == --connections"); } Prevention
- Omit --queries entirely in first-query latency runs
- Keep latency (first) and throughput/warm invocations in separate scripts
- Assert state/queries invariants in CI wrappers
When it happens
Trigger: Running `fts-bench --state first --queries 500 --connections 8`: the ensure! fires because queries (500) != connections (8). Also fires with --state first when the defaulted/overridden query count does not match connections.
Common situations: Mixing first-query-latency intent with a leftover --queries value from a warm/search run; assuming first-query mode can also collect warm-query statistics.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- need at least one query per connection
- --queries requires --benchmark search
- seconds must be finite and positive
- --seconds requires --benchmark throughput
- throughput requires --state warm
AI-assisted analysis of tursodatabase/turso@8d4a589f8d (2026-09-20).
Data as JSON: /api/errors/27caff5f450ba750.
Report an issue: GitHub.
Appendix: source
Thrown at perf/fts/src/main.rs:86
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"
);
let seconds = args.seconds.unwrap_or(5.0);
ensure!(
seconds.is_finite() && seconds > 0.0,
"seconds must be finite and positive"View on GitHub (pinned to 8d4a589f8d)