{"record":{"id":"7fb6255d02e19d23","repo":"tursodatabase/turso","slug":"throughput-requires-state-warm","errorCode":null,"errorMessage":"throughput requires --state warm","messagePattern":"throughput requires --state warm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"perf/fts/src/main.rs","lineNumber":97,"sourceCode":"                } 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\"))))]\n    let profiled = false;\n    #[cfg(all(feature = \"flamegraph\", any(target_os = \"linux\", target_os = \"macos\")))]\n    if let Some(directory) = &args.flamegraph {\n        std::fs::create_dir(directory)?;","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/perf/fts/src/main.rs#L79-L115","documentation":"Throughput mode requires the warm query state: it measures steady-state queries per second and cold caches or first-connection effects would skew results. ensure! at perf/fts/src/main.rs:97 rejects any --state other than warm when --benchmark throughput is selected.","triggerScenarios":"Running `fts-bench --benchmark throughput --state first` (or any non-warm state). The ensure! fires whenever matches!(args.state, QueryState::Warm) is false in the Throughput branch.","commonSituations":"Leaving a --state first flag from a latency run while switching the benchmark to throughput; assuming throughput mode supports cold-start measurement.","solutions":["Add or change to --state warm when using --benchmark throughput","Drop the explicit --state flag only if warm is the default (otherwise set it explicitly)","Run search mode instead if first-query/cold behavior is what you want to measure"],"exampleFix":"// before\nfts-bench --benchmark throughput --state first --seconds 10\n// after\nfts-bench --benchmark throughput --state warm --seconds 10","handlingStrategy":"validation","validationCode":"if benchmark == Throughput && state != Warm { panic!(\"--benchmark throughput requires --state warm\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set --state explicitly rather than relying on defaults","Purge stale --state flags when switching benchmark modes","Encode mode+state pairs in scripts, not independent flags"],"tags":["cli","argument-validation","benchmark"],"backgroundTag":"conflicting-config-options","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"}