{"record":{"id":"27cec0b70fc0cefe","repo":"apache/druid","slug":"unknown-query-type-s","errorCode":null,"errorMessage":"Unknown query type[%s].","messagePattern":"Unknown query type\\[(.+?)\\]\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/segment/realtime/appenderator/SinkQuerySegmentWalker.java","lineNumber":186,"sourceCode":"\n    return getQueryRunnerForSegments(query, specs);\n  }\n\n  @Override\n  public <T> QueryRunner<T> getQueryRunnerForSegments(final Query<T> query, final Iterable<SegmentDescriptor> specs)\n  {\n    ExecutionVertex ev = ExecutionVertex.of(query);\n    // We only handle one particular dataSource. Make sure that's what we have, then ignore from here on out.\n    final DataSource dataSourceFromQuery = query.getDataSource();\n\n    // Sanity check: make sure the query is based on the table we're meant to handle.\n    if (!ev.getBaseTableDataSource().getName().equals(dataSource)) {\n      throw new ISE(\"Cannot handle datasource: %s\", dataSourceFromQuery);\n    }\n\n    final QueryRunnerFactory<T, Query<T>> factory = conglomerate.findFactory(query);\n    if (factory == null) {\n      throw new ISE(\"Unknown query type[%s].\", query.getClass());\n    }\n\n    final QueryToolChest<T, Query<T>> toolChest = factory.getToolchest();\n    final boolean skipIncrementalSegment = query.context().getBoolean(CONTEXT_SKIP_INCREMENTAL_SEGMENT, false);\n    final AtomicLong cpuTimeAccumulator = new AtomicLong(0L);\n\n    // Make sure this query type can handle the subquery, if present.\n    if ((dataSourceFromQuery instanceof QueryDataSource)\n        && !toolChest.canPerformSubquery(((QueryDataSource) dataSourceFromQuery).getQuery())) {\n      throw new ISE(\"Cannot handle subquery: %s\", dataSourceFromQuery);\n    }\n\n    // segmentMapFn maps each base Segment into a joined Segment if necessary.\n    final SegmentMapFunction segmentMapFn = JvmUtils.safeAccumulateThreadCpuTime(\n        cpuTimeAccumulator,\n        () -> ev.createSegmentMapFunction(policyEnforcer)\n    );\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/segment/realtime/appenderator/SinkQuerySegmentWalker.java#L168-L204","documentation":"After validating the datasource, getQueryRunnerForSegments looks up a QueryRunnerFactory for the query type in the QueryToolChestWarehouse (conglomerate). If no factory is registered for that query class, it throws this ISE — the peon's query stack does not support that query type.","triggerScenarios":"Submitting a query type not registered on the peon (e.g. a non-native/query type from an extension that the peon's warehouse lacks a factory for), or a custom query type used before registering its factory.","commonSituations":"Extension providing a custom query type not loaded on the middle-manager/peon; version mismatch where broker forwards a query type the peon doesn't support; typo'd query type in internal tooling.","solutions":["Install/enable the extension that registers a QueryRunnerFactory for the query type on the peon's classpath","Check druid.extensions.loadList on the middle-manager includes the needed extension","Verify broker and peon versions/extensions match so the forwarded query type is supported end-to-end"],"exampleFix":"// before\n// query type 'custom' with extension not loaded on peon -> throws\n// after\ndruid.extension.loadList=[\"druid-custom-query\"] // in middleManager runtime.properties","handlingStrategy":"validation","validationCode":"if (warehouse.lookupFactory(queryClass) == null) { throw new UnsupportedOperationException(\"query type not supported on peon\"); }","typeGuard":"boolean supported = conglomerate.findFactory(query) != null;","tryCatchPattern":"try { return walker.getQueryRunnerForSegments(query, specs); } catch (ISE e) { log.error(\"unsupported query type \" + query.getClass() + \"; check extensions\", e); throw e; }","preventionTips":["Load all query extensions on middle-manager/peon classpath","Keep broker and peon extension sets and versions aligned","Register factories for any custom query types before use"],"tags":["java","query","extensions"],"backgroundTag":"unsupported-operation","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"}