apache/druid · error · IllegalArgumentException

leaderSessionTtl [ ] must be at least seconds

Error message

leaderSessionTtl [%s] must be at least %d seconds

What it means

LeaderElectionConfig validation: the (computed) Consul leader session TTL must be at least the required minimum (derived from healthCheckInterval, floor 45s) so the session outlives a health-check period; too-small explicit values are rejected.

Solutions

  1. Raise leaderSessionTtl, or unset it to use the computed default max(45, 3 x healthCheckInterval) seconds.
  2. Shorten healthCheckInterval if a smaller TTL is genuinely required.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:595 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/16f4fbe9b5997f53. Report an issue: GitHub.

Appendix: source

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

      this.leaderRetryBackoffMax = validatePositive(
          leaderRetryBackoffMax,
          DEFAULT_LEADER_RETRY_BACKOFF_MAX_MS,
          "leaderRetryBackoffMax"
      );
    }

    private static Duration computeLeaderSessionTtl(Duration leaderSessionTtl, Duration healthCheckInterval)
    {
      Duration ttl = leaderSessionTtl;
      if (ttl == null) {
        long defaultTtlSeconds = 45; // Default TTL when healthCheckInterval is null
        if (healthCheckInterval != null) {
          defaultTtlSeconds = Math.max(45, healthCheckInterval.getStandardSeconds() * 3);
        }
        ttl = Duration.standardSeconds(defaultTtlSeconds);
      }
      if (ttl.getStandardSeconds() < MIN_LEADER_SESSION_TTL_SECONDS) {
        throw new IAE(
            StringUtils.format(
                "leaderSessionTtl [%s] must be at least %d seconds",
                ttl,
                MIN_LEADER_SESSION_TTL_SECONDS
            )
        );
      }
      return ttl;
    }

    /**
     * Returns true if the user explicitly provided a leaderSessionTtl value in their config.
     * Used by {@link ConsulDiscoveryConfig#computeLeaderElectionConfig} to decide whether
     * to recompute the TTL based on the healthCheckInterval from service config.
     */
    public boolean isLeaderSessionTtlWasExplicitlySet()
    {
      return leaderSessionTtlWasExplicitlySet;

View on GitHub (pinned to 9b90983fd2)