tursodatabase/turso · error
connections must be positive
Error message
connections must be positive
What it means
FtsConfig::validate() rejects configurations where connections is zero. The benchmark opens one session per connection and queries across all of them; with zero connections there is nothing to measure, so validation fails before setup.
Source
Thrown at perf/memory/src/fts.rs:277
}
.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"))?;View on GitHub (pinned to 492c4a71cd)
Solutions
- Pass a positive connection count, e.g. --connections 4
- Clamp or default the computed value: connections.max(1)
- Validate user input before constructing FtsConfig
Example fix
// before
FtsConfig { connections: 0, .. }
// after
FtsConfig { connections: 4, .. } Defensive patterns
Strategy: validation
Validate before calling
if connections == 0 { return Err(anyhow!("connections must be > 0")); } Try / catch
if let Err(e) = config.validate() {
if e.to_string().contains("connections must be positive") {
// rebuild with connections.max(1)
}
} Prevention
- Default concurrency to at least 1 when derived from environment
- Validate numeric CLI args for positivity at parse time
- Run validate() before opening any connections
When it happens
Trigger: Building FtsConfig with connections == 0, e.g. --connections 0 or a default derived from an empty/zero input.
Common situations: Command-line typo; concurrency value loaded from an unset env var or empty config file; programmatic use where the caller passes a computed parallelism of 0.
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
- index contains {} segment bytes, below requested minimum {};
- documents must be positive
- queries or transactions must be positive
- queries per transaction must be positive
- first-query runs require one query per connection; use warm
AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13).
Data as JSON: /api/errors/f92a5375e4de9b06.
Report an issue: GitHub.