{"record":{"id":"08f619292a3e5c72","repo":"tursodatabase/turso","slug":"path-unknown-or-duplicate-query-query","errorCode":null,"errorMessage":"{path}: unknown or duplicate query {query}","messagePattern":"(.+?): unknown or duplicate query (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"perf/fts/plot/plot-fts.py","lineNumber":113,"sourceCode":"        required = set(CONFIGURATION) | {\"engine\", \"mode\", \"run\", \"query\", \"queries\"}\n        if not required <= set(reader.fieldnames or []):\n            raise ValueError(f\"{path}: missing benchmark columns\")\n        for row in reader:\n            if row.get(\"profiled\", \"false\") != \"false\":\n                raise ValueError(\"profiled timings must not be used for benchmark comparisons\")\n            current = tuple(row[key] for key in CONFIGURATION)\n            if configuration is None:\n                configuration = current\n            if configuration != current:\n                raise ValueError(\"plot only one configuration at a time\")\n            key = (row[\"engine\"], row[\"mode\"])\n            if key not in SERIES:\n                raise ValueError(f\"unsupported engine/mode: {key}\")\n            series = samples.setdefault(key, {query: [] for query in QUERIES})\n            query = row[\"query\"]\n            seen = runs.setdefault(row[\"run\"], {}).setdefault(key, set())\n            if query not in QUERIES or query in seen:\n                raise ValueError(f\"{path}: unknown or duplicate query {query}\")\n            seen.add(query)\n            series[query].append(read_measurement(row, percentile))\n    if not runs:\n        raise ValueError(f\"{path}: no results found\")\n    return configuration, runs\n\n\ndef read_measurement(row, percentile):\n    queries = int(row[\"queries\"])\n    positive_number(queries)\n    if row[\"benchmark\"] != \"memory\":\n        seconds = positive_number(row[\"seconds\"])\n    if row[\"benchmark\"] == \"memory\":\n        if row[\"engine\"] != \"turso\" or queries != int(row[\"requested_queries\"]) * int(row[\"connections\"]):\n            raise ValueError(\"heap results require Turso and the requested queries per connection\")\n        value = float(row[\"peak_heap_bytes\"]) / (1024 * 1024)\n    elif row[\"benchmark\"] == \"search\":\n        if not 0 < int(row[\"connections\"]) <= queries or queries != int(row[\"requested_queries\"]):","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/perf/fts/plot/plot-fts.py#L95-L131","documentation":"Each (run, engine/mode) pair may contain each known query at most once, and only queries listed in QUERIES are accepted. A row with an unrecognized query name or a duplicate within the same run/series fails this check.","triggerScenarios":"CSV has a query name not in QUERIES (typo or new query) or repeats the same query twice for the same run and engine/mode.","commonSituations":"Concatenating overlapping result files so a run appears twice; renaming queries in the harness without updating QUERIES; duplicated rows from an aborted and restarted run.","solutions":["Remove duplicate query rows for that run from the CSV","Add the new query name to the QUERIES list in plot-fts.py","Fix the query spelling to match QUERIES"],"exampleFix":"// before (CSV)\nrun1,turso,...,query=lookup\nrun1,turso,...,query=lookup\n// after\nrun1,turso,...,query=lookup\nrun2,turso,...,query=lookup","handlingStrategy":"validation","validationCode":"def validate_queries(rows):\n    seen = set()\n    for r in rows:\n        key = (r[\"run\"], r[\"engine\"], r[\"mode\"], r[\"query\"])\n        if r[\"query\"] not in QUERIES or key in seen:\n            raise ValueError(f\"unknown or duplicate query {r['query']}\")\n        seen.add(key)","typeGuard":"def is_known_unique_query(row, seen) -> bool:\n    return row[\"query\"] in QUERIES and (row[\"run\"], row[\"engine\"], row[\"mode\"], row[\"query\"]) not in seen","tryCatchPattern":"try:\n    configuration, runs = read_runs(path, percentile)\nexcept ValueError as e:\n    print(f\"dedupe or extend QUERIES: {e}\")","preventionTips":["Add new query names to QUERIES when adding them to the harness","Avoid concatenating overlapping run files","Deduplicate result rows before plotting"],"tags":["python","benchmark","duplicate"],"backgroundTag":"schema-validation-failed","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"}