{"record":{"id":"5ab456a28ec80e63","repo":"apache/druid","slug":"don-t-query-me-bro","errorCode":null,"errorMessage":"Don't query me, bro.","messagePattern":"Don't query me, bro\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderator.java","lineNumber":546,"sourceCode":"\n      try {\n        segmentAnnouncer.announceSegment(retVal.getSegment());\n      }\n      catch (IOException e) {\n        log.makeAlert(e, \"Failed to announce new segment[%s]\", schema.getDataSource())\n           .addData(\"interval\", retVal.getInterval())\n           .emit();\n      }\n    }\n\n    return retVal;\n  }\n\n  @Override\n  public <T> QueryRunner<T> getQueryRunnerForIntervals(final Query<T> query, final Iterable<Interval> intervals)\n  {\n    if (texasRanger == null) {\n      throw new IllegalStateException(\"Don't query me, bro.\");\n    }\n\n    return texasRanger.getQueryRunnerForIntervals(query, intervals);\n  }\n\n  @Override\n  public <T> QueryRunner<T> getQueryRunnerForSegments(final Query<T> query, final Iterable<SegmentDescriptor> specs)\n  {\n    if (texasRanger == null) {\n      throw new IllegalStateException(\"Don't query me, bro.\");\n    }\n\n    return texasRanger.getQueryRunnerForSegments(query, specs);\n  }\n\n  @Override\n  public void clear() throws InterruptedException\n  {","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderator.java#L528-L564","documentation":"StreamAppenderator.getQueryRunnerForIntervals throws IllegalStateException(\"Don't query me, bro.\") when the appenderator's queryRunnerFactoryCollaborator (texasRanger) was never initialized — i.e., the appenderator is not wired into a query infrastructure. The appenderator itself is not queryable until initialized with query support.","triggerScenarios":"Calling getQueryRunnerForIntervals on an appenderator created without queryRunnerFactoryCollaborator (e.g. BatchAppenderator or tasks that never register a query runner factory), or after stop() clearing the collaborator.","commonSituations":"Embedding an appenderator in custom ingestion code and attempting to query it directly without registering query runner factories; querying a task's segments through the wrong component.","solutions":["Query segments via the task's QueryableDruidServer/QueryLifecycle instead of the appenderator directly.","Initialize the appenderator with a QueryRunnerFactoryCollaborator if in-process querying is intended.","Ensure stop() was not called before issuing queries."],"exampleFix":"// before\nappenderator.getQueryRunnerForIntervals(query, intervals); // texasRanger null\n\n// after\nQueryRunner<T> runner = queryLifecycle.run(query) // or wire collaborator at appenderator construction","handlingStrategy":"validation","validationCode":"// only query through the appenderator if it was initialized with query support\nif (!appenderatorSupportsQueries(config)) { throw new UnsupportedOperationException(\"use task query path\"); }","typeGuard":null,"tryCatchPattern":"try { return runnerFactory.getRunner(...) } catch (IllegalStateException e) { if (e.getMessage().equals(\"Don't query me, bro.\")) { return queryViaTaskApi(query); } throw e; }","preventionTips":["Never query an Appenderator directly in custom pipelines","Route queries via broker or task's query runner","Don't reuse an appenderator after stop()"],"tags":["druid","query","unsupported-operation","initialization"],"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"}