{"record":{"id":"114bb3f72d7fbcc5","repo":"apache/druid","slug":"service-cannot-be-null","errorCode":null,"errorMessage":"service cannot be null","messagePattern":"service cannot be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java","lineNumber":68,"sourceCode":"  private final ServiceConfig service;\n\n  @JsonProperty(\"leader\")\n  private final LeaderElectionConfig leader;\n\n  @JsonProperty(\"watch\")\n  private final WatchConfig watch;\n\n  @JsonCreator\n  public static ConsulDiscoveryConfig create(\n      @JsonProperty(\"connection\") @Nullable ConnectionConfig connection,\n      @JsonProperty(\"auth\") @Nullable AuthConfig auth,\n      @JsonProperty(\"service\") ServiceConfig service,\n      @JsonProperty(\"leader\") @Nullable LeaderElectionConfig leader,\n      @JsonProperty(\"watch\") @Nullable WatchConfig watch\n  )\n  {\n    if (service == null) {\n      throw new IAE(\"service cannot be null\");\n    }\n\n    LeaderElectionConfig finalLeader = computeLeaderElectionConfig(leader, service.getHealthCheckInterval());\n    return new ConsulDiscoveryConfig(connection, auth, service, finalLeader, watch);\n  }\n\n  private static LeaderElectionConfig computeLeaderElectionConfig(\n      @Nullable LeaderElectionConfig leader,\n      Duration healthCheckInterval\n  )\n  {\n    if (leader != null) {\n      // Recompute TTL based on service's healthCheckInterval if user didn't explicitly set one.\n      // This is needed because Jackson deserializes LeaderElectionConfig before we have access\n      // to the service config's healthCheckInterval.\n      if (!leader.isLeaderSessionTtlWasExplicitlySet()) {\n        return new LeaderElectionConfig(\n            leader.getCoordinatorLeaderLockPath(),","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java#L50-L86","documentation":"@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.","triggerScenarios":"Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a `service` section with at least a servicePrefix to the Consul discovery config.","Check the JSON property name/nesting so the service block actually binds."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}