apache/druid · error · IllegalArgumentException

port must be between 1 and 65535

Error message

port must be between 1 and 65535

What it means

Generic input validation inside ConsulDiscoveryConfig's private validatePort helper: the configured consul port property parsed to a value outside the valid TCP port range 1-65535. This is a configuration-time validation error — fix the port value in the consul discovery config properties and restart.

Solutions

  1. Set connection.port to a value between 1 and 65535 (default Consul agent port 8500).
  2. Remove the port property to use the 8500 default.
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

      this.socketTimeout = validatePositive(socketTimeout, DEFAULT_SOCKET_TIMEOUT_MS, "socketTimeout");
      this.sslClientConfig = sslClientConfig;
      this.maxTotalConnections = validateConnectionPoolSize(
          maxTotalConnections,
          DEFAULT_MAX_TOTAL_CONNECTIONS,
          "maxTotalConnections"
      );
      this.maxConnectionsPerRoute = validateConnectionPoolSize(
          maxConnectionsPerRoute,
          DEFAULT_MAX_CONNECTIONS_PER_ROUTE,
          "maxConnectionsPerRoute"
      );
    }

    private static int validatePort(Integer port)
    {
      int portValue = port == null ? 8500 : port;
      if (portValue < 1 || portValue > 65535) {
        throw new IllegalArgumentException("port must be between 1 and 65535");
      }
      return portValue;
    }

    private static int validateConnectionPoolSize(Integer value, int defaultValue, String name)
    {
      int result = value == null ? defaultValue : value;
      if (result <= 0) {
        throw new IAE(name + " must be positive");
      }
      return result;
    }

    @JsonProperty
    public String getHost()
    {
      return host;
    }

View on GitHub (pinned to 9b90983fd2)