{"record":{"id":"a265ff9bed991f80","repo":"tursodatabase/turso","slug":"queries-requires-benchmark-search","errorCode":null,"errorMessage":"--queries requires --benchmark search","messagePattern":"--queries requires --benchmark search","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"perf/fts/src/main.rs","lineNumber":93,"sourceCode":"            let queries = args\n                .queries\n                .unwrap_or(if matches!(args.state, QueryState::First) {\n                    args.connections\n                } else {\n                    10_000\n                });\n            ensure!(\n                queries >= args.connections,\n                \"need at least one query per connection\"\n            );\n            ensure!(\n                !matches!(args.state, QueryState::First) || queries == args.connections,\n                \"first-query latency requires one query per connection\"\n            );\n            (queries, 0.0)\n        }\n        Benchmark::Throughput => {\n            ensure!(\n                args.queries.is_none(),\n                \"--queries requires --benchmark search\"\n            );\n            ensure!(\n                matches!(args.state, QueryState::Warm),\n                \"throughput requires --state warm\"\n            );\n            let seconds = args.seconds.unwrap_or(5.0);\n            ensure!(\n                seconds.is_finite() && seconds > 0.0,\n                \"seconds must be finite and positive\"\n            );\n            (0, seconds)\n        }\n    };\n    #[cfg(all(feature = \"flamegraph\", any(target_os = \"linux\", target_os = \"macos\")))]\n    let profiled = args.flamegraph.is_some();\n    #[cfg(not(all(feature = \"flamegraph\", any(target_os = \"linux\", target_os = \"macos\"))))]","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/perf/fts/src/main.rs#L75-L111","documentation":"The throughput benchmark is time-based and derives its workload from --seconds, not a query count. ensure! at perf/fts/src/main.rs:93 rejects --queries when --benchmark throughput is selected, since a fixed query count contradicts the run-until-duration model.","triggerScenarios":"Running `fts-bench --benchmark throughput --queries 1000`: ensure! fires because args.queries.is_some() in the Throughput branch. Happens whenever a search-style invocation is switched to throughput without dropping --queries.","commonSituations":"Reusing a search-benchmark command line for throughput runs; scripts parameterizing both --queries and --seconds and passing both unconditionally.","solutions":["Remove --queries when running --benchmark throughput","Keep --queries and switch back to --benchmark search (the default)","Make the wrapper script pass --queries only for search mode"],"exampleFix":"// before\nfts-bench --benchmark throughput --queries 1000 --seconds 10\n// after\nfts-bench --benchmark throughput --seconds 10","handlingStrategy":"validation","validationCode":"if benchmark == Throughput && queries.is_some() { panic!(\"--queries only applies to the search benchmark\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use template commands per benchmark mode instead of one parameterized line","Pass --queries conditionally in wrapper scripts based on benchmark","Run the binary with --help when flags stop being accepted"],"tags":["cli","argument-validation","benchmark"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"8d4a589f8d13ac184700d2a8f724f27e1995be3b","analyzedAt":"2026-09-20T13:18:14.658Z","contentChangedAt":"2026-09-20T13:18:14.658Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}