apache/druid · error · IllegalStateException

Monitor doesn't support working with lazy loading on start

Error message

Monitor doesn't support working with lazy loading on start

What it means

SegmentStatsMonitor's constructor throws IllegalStateException if the segment loader config enables lazyLoadOnStart. The monitor needs segments loaded eagerly at startup to report segment statistics and does not support deferred loading, so Druid fails fast (killing the process at startup) rather than running the monitor with missing data.

Solutions

  1. Remove SegmentStatsMonitor from druid.monitoring.monitors when lazyLoadOnStart=true
  2. Set druid.segmentCache.lazyLoadOnStart=false if segment stats monitoring is required
  3. Replace SegmentStatsMonitor with a monitor compatible with lazy loading
  4. Document the incompatibility in your cluster config templates to prevent recurrence

Example fix

// before
druid.monitoring.monitors=["org.apache.druid.server.metrics.SegmentStatsMonitor"]
druid.segmentCache.lazyLoadOnStart=true
// after
druid.monitoring.monitors=[]
druid.segmentCache.lazyLoadOnStart=true
Defensive patterns

Strategy: validation

Validate before calling

boolean isBadCombo = monitors.contains("SegmentStatsMonitor") && Boolean.parseBoolean(props.getProperty("druid.segmentCache.lazyLoadOnStart"));

Prevention

When it happens

Trigger: Configuring a SegmentStatsMonitor in druid.monitoring.monitors together with druid.segmentCache.lazyLoadOnStart=true on a historical node.

Common situations: Enabling lazy loading to speed historical startup while keeping the default SegmentStatsMonitor in the monitors list; config templates combining monitoring and lazy-load settings written independently.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/bc55f038d5dca9c5. Report an issue: GitHub.

Appendix: source

Thrown at server/src/main/java/org/apache/druid/server/metrics/SegmentStatsMonitor.java:70

  /**
   * Constructor for this monitor. Will throw IllegalStateException if lazy load on start is set to true.
   *
   * @param serverConfig
   * @param segmentLoadDropHandler
   * @param segmentLoaderConfig
   */
  @Inject
  public SegmentStatsMonitor(
      DruidServerConfig serverConfig,
      SegmentLoadDropHandler segmentLoadDropHandler,
      SegmentLoaderConfig segmentLoaderConfig
  )
  {
    if (segmentLoaderConfig.isLazyLoadOnStart()) {
      // log message ensures there is an error displayed at startup if this fails as the exception isn't logged.
      log.error("Monitor doesn't support working with lazy loading on start");
      // throw this exception it kill the process at startup
      throw new IllegalStateException("Monitor doesn't support working with lazy loading on start");
    }
    this.serverConfig = serverConfig;
    this.segmentLoadDropHandler = segmentLoadDropHandler;

  }

  @Override
  public boolean doMonitor(ServiceEmitter emitter)
  {
    for (Map.Entry<String, Long> entry : segmentLoadDropHandler.getAverageNumOfRowsPerSegmentForDatasource().entrySet()) {
      String dataSource = entry.getKey();
      long averageSize = entry.getValue();
      final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder()
          .setDimension(DruidMetrics.DATASOURCE, dataSource)
          .setDimension("tier", serverConfig.getTier())
          .setDimension("priority", String.valueOf(serverConfig.getPriority()));
      emitter.emit(builder.setMetric("segment/rowCount/avg", averageSize));
    }

View on GitHub (pinned to 9b90983fd2)