apache/druid · error · IllegalArgumentException

service cannot be null

Error message

service cannot be null

What it means

@JsonCreator guard on ConsulDiscoveryConfig.create: the `service` block (servicePrefix, healthCheckInterval, etc.) is mandatory; a Consul discovery config deserialized without it is rejected at config-load time.

Solutions

  1. Add a `service` section with at least a servicePrefix to the Consul discovery config.
  2. Check the JSON property name/nesting so the service block actually binds.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:68

  private final ServiceConfig service;

  @JsonProperty("leader")
  private final LeaderElectionConfig leader;

  @JsonProperty("watch")
  private final WatchConfig watch;

  @JsonCreator
  public static ConsulDiscoveryConfig create(
      @JsonProperty("connection") @Nullable ConnectionConfig connection,
      @JsonProperty("auth") @Nullable AuthConfig auth,
      @JsonProperty("service") ServiceConfig service,
      @JsonProperty("leader") @Nullable LeaderElectionConfig leader,
      @JsonProperty("watch") @Nullable WatchConfig watch
  )
  {
    if (service == null) {
      throw new IAE("service cannot be null");
    }

    LeaderElectionConfig finalLeader = computeLeaderElectionConfig(leader, service.getHealthCheckInterval());
    return new ConsulDiscoveryConfig(connection, auth, service, finalLeader, watch);
  }

  private static LeaderElectionConfig computeLeaderElectionConfig(
      @Nullable LeaderElectionConfig leader,
      Duration healthCheckInterval
  )
  {
    if (leader != null) {
      // Recompute TTL based on service's healthCheckInterval if user didn't explicitly set one.
      // This is needed because Jackson deserializes LeaderElectionConfig before we have access
      // to the service config's healthCheckInterval.
      if (!leader.isLeaderSessionTtlWasExplicitlySet()) {
        return new LeaderElectionConfig(
            leader.getCoordinatorLeaderLockPath(),

View on GitHub (pinned to 9b90983fd2)