{"record":{"id":"16f4fbe9b5997f53","repo":"apache/druid","slug":"leadersessionttl-s-must-be-at-least-d-seconds","errorCode":null,"errorMessage":"leaderSessionTtl [%s] must be at least %d seconds","messagePattern":"leaderSessionTtl \\[(.+?)\\] must be at least (.+?) seconds","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java","lineNumber":595,"sourceCode":"      this.leaderRetryBackoffMax = validatePositive(\n          leaderRetryBackoffMax,\n          DEFAULT_LEADER_RETRY_BACKOFF_MAX_MS,\n          \"leaderRetryBackoffMax\"\n      );\n    }\n\n    private static Duration computeLeaderSessionTtl(Duration leaderSessionTtl, Duration healthCheckInterval)\n    {\n      Duration ttl = leaderSessionTtl;\n      if (ttl == null) {\n        long defaultTtlSeconds = 45; // Default TTL when healthCheckInterval is null\n        if (healthCheckInterval != null) {\n          defaultTtlSeconds = Math.max(45, healthCheckInterval.getStandardSeconds() * 3);\n        }\n        ttl = Duration.standardSeconds(defaultTtlSeconds);\n      }\n      if (ttl.getStandardSeconds() < MIN_LEADER_SESSION_TTL_SECONDS) {\n        throw new IAE(\n            StringUtils.format(\n                \"leaderSessionTtl [%s] must be at least %d seconds\",\n                ttl,\n                MIN_LEADER_SESSION_TTL_SECONDS\n            )\n        );\n      }\n      return ttl;\n    }\n\n    /**\n     * Returns true if the user explicitly provided a leaderSessionTtl value in their config.\n     * Used by {@link ConsulDiscoveryConfig#computeLeaderElectionConfig} to decide whether\n     * to recompute the TTL based on the healthCheckInterval from service config.\n     */\n    public boolean isLeaderSessionTtlWasExplicitlySet()\n    {\n      return leaderSessionTtlWasExplicitlySet;","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java#L577-L613","documentation":"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.","triggerScenarios":"Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDiscoveryConfig.java:595 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise leaderSessionTtl, or unset it to use the computed default max(45, 3 x healthCheckInterval) seconds.","Shorten healthCheckInterval if a smaller TTL is genuinely required."],"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"}