tursodatabase/turso · error · ValueError
each sweep file must have a distinct positive connection…
Error message
each sweep file must have a distinct positive connection count
What it means
read_sweep aggregates multiple FTS benchmark sweep CSV files into one plot series keyed by connection count. It raises this ValueError when a file's 'connections' value is zero/negative or duplicates a connection count already seen in another sweep file, because the plot needs one distinct x-axis point per file.
Solutions
- Rerun the benchmark sweep with a unique, positive connection count for each result file.
- Remove duplicate sweep files that record the same connection count.
- Fix the CSV generation so the 'connections' column always holds a positive integer.
Example fix
# before python plot-fts.py results/c8.csv results/c8.csv # after python plot-fts.py results/c1.csv results/c8.csv results/c32.csv
Defensive patterns
Strategy: validation
Validate before calling
import csv conns = [int(next(csv.DictReader(open(p))['connections'])) for p in paths] assert all(c > 0 for c in conns), 'all connection counts must be positive' assert len(set(conns)) == len(conns), 'connection counts must be distinct across sweep files'
Try / catch
try:
config, points = read_sweep(paths)
except ValueError as e:
if 'distinct positive connection count' in str(e):
print('Fix: rerun sweeps with unique, positive connection counts')
else:
raise Prevention
- Name sweep result files by connection count and verify uniqueness before plotting.
- Never pass the same sweep file twice on the command line.
- Add a sanity check in the benchmark harness that connections is a positive integer.
When it happens
Trigger: Calling read_sweep (via main) with sweep CSVs where two files record the same 'connections' value, or a file records connections <= 0.
Common situations: Copying a sweep result file and forgetting to rerun with a different connection count; a buggy benchmark run writing connections=0; passing the same file twice on the command line.
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
- plot only one configuration at a time
- sweep files must match benchmark, sample budget, fixture…
- no results found
- no sweep results found
- : each run must contain the same series and all six query…
AI-assisted analysis of tursodatabase/turso@8d4a589f8d (2026-09-20).
Data as JSON: /api/errors/48d6ed22b075f370.
Report an issue: GitHub.
Appendix: source
Thrown at perf/fts/plot/plot-fts.py:57
configuration, samples = (
read_sweep(args.csv_files, args.percentile) if args.sweep else read_runs(args.csv_files, args.percentile)
)
for output in args.output or [Path("fts.png"), Path("fts.pdf")]:
if args.sweep:
plot_sweep(configuration, samples, output, args.relative)
else:
plot(configuration, samples, output)
print(f"wrote {output}")
def read_sweep(paths, percentile="p50"):
configuration = None
points = {}
for path in paths:
current, samples = read_runs([path], percentile)
connections = int(current.pop("connections"))
if connections <= 0 or connections in points:
raise ValueError("each sweep file must have a distinct positive connection count")
if configuration is None:
configuration = current
if current != configuration or (points and set(samples) != set(next(iter(points.values())))):
raise ValueError("sweep files must match benchmark, sample budget, fixture and engine/mode series")
points[connections] = samples
if not points:
raise ValueError("no sweep results found")
return configuration, dict(sorted(points.items()))
def read_runs(paths, percentile="p50"):
configuration = None
samples = {}
expected_series = None
for path in paths:
current, runs = read_file(path, percentile, samples)
if configuration is None:
configuration = currentView on GitHub (pinned to 8d4a589f8d)