{"record":{"id":"964377b761080478","repo":"apache/druid","slug":"unknown-strategy-s-query-id-s","errorCode":null,"errorMessage":"Unknown strategy[%s], query id [%s]","messagePattern":"Unknown strategy\\[(.+?)\\], query id \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/search/SearchStrategySelector.java","lineNumber":52,"sourceCode":"  {\n    this.config = configSupplier.get();\n  }\n\n  public SearchStrategy strategize(SearchQuery query)\n  {\n    final String strategyString = config.withOverrides(query).getSearchStrategy();\n\n    switch (strategyString) {\n      case \"auto\":\n        log.debug(\"Auto strategy is selected but has been removed, using 'use-index' strategy instead for query id [%s]\", query.getId());\n      case UseIndexesStrategy.NAME:\n        log.debug(\"Use-index strategy is selected, query id [%s]\", query.getId());\n        return UseIndexesStrategy.of(query);\n      case CursorOnlyStrategy.NAME:\n        log.debug(\"Cursor-only strategy is selected, query id [%s]\", query.getId());\n        return CursorOnlyStrategy.of(query);\n      default:\n        throw new ISE(\"Unknown strategy[%s], query id [%s]\", strategyString, query.getId());\n    }\n  }\n}\n","sourceCodeStart":34,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/search/SearchStrategySelector.java#L34-L56","documentation":"SearchStrategySelector.strategize() dispatches on the 'searchStrategy' query parameter; an unrecognized value falls through the switch and throws ISE('Unknown strategy[...], query id [...]'). Druid supports only a fixed set of strategies (e.g. use-index, cursor-only). A misspelled or unavailable strategy name in the query context triggers it.","triggerScenarios":"Setting searchStrategy to a typo'd or unsupported value in the query context; using a strategy name removed or renamed in a newer Druid version; programmatic context maps with invalid values.","commonSituations":"Copying query snippets with outdated strategy names; clients passing arbitrary tuning keys expecting them to be ignored; version upgrades renaming strategies.","solutions":["Set searchStrategy to a valid value such as 'use-index' or 'cursor-only', or remove the key to use auto-selection","Check the Druid version's supported strategy names (SearchStrategySelector switch)","Correct typos in the query context key/value"],"exampleFix":"// before\n{\"searchStrategy\": \"index-only\"}\n// after\n{\"searchStrategy\": \"use-index\"} // or omit to let Druid choose","handlingStrategy":"validation","validationCode":"Set.of(\"use-index\",\"cursor-only\").contains(context.get(\"searchStrategy\")) // validate before submitting","typeGuard":"boolean isValidSearchStrategy(Object v) { return v == null || v instanceof String && Set.of(\"use-index\",\"cursor-only\").contains(v); }","tryCatchPattern":"try { runner.search(query); } catch (ISE e) { if (e.getMessage().startsWith(\"Unknown strategy\")) { retryWithoutSearchStrategyContext(); } else throw e; }","preventionTips":["Only set searchStrategy to values documented for your Druid version","Omit the key to let Druid auto-select the strategy","Diff query context keys against the current SearchStrategySelector when upgrading"],"tags":["search-query","invalid-enum-value","query-context"],"backgroundTag":"invalid-enum-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}