apache/druid · error · IllegalArgumentException

Invalid port in

Error message

Invalid port in %s

What it means

RedisCacheFactory.create found a cluster node entry whose port portion is not a valid integer (or the port substring is missing/empty). Each node in the cluster 'nodes' config must be host:port with a numeric port; a bad port makes the node unusable, so an IAE naming the offending node is thrown.

Solutions

  1. Correct the port in the druid.cache.cluster.nodes config; ports must be numeric (typically 6379 or 16379 for TLS).
  2. Check for typos such as host: or host:abc or copy-pasted whitespace.
  3. Validate all node entries parse to a valid port range (1-65535) before applying the config.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-contrib/redis-cache/src/main/java/org/apache/druid/client/cache/RedisCacheFactory.java:59 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/1b6e22e166ea6634. Report an issue: GitHub.

Appendix: source

Thrown at extensions-contrib/redis-cache/src/main/java/org/apache/druid/client/cache/RedisCacheFactory.java:59

  public static Cache create(final RedisCacheConfig config)
  {
    if (config.getCluster() != null && StringUtils.isNotBlank(config.getCluster().getNodes())) {

      Set<HostAndPort> nodes = Arrays.stream(config.getCluster().getNodes().split(","))
                                     .map(String::trim)
                                     .filter(StringUtils::isNotBlank)
                                     .map(hostAndPort -> {
                                       int index = hostAndPort.indexOf(':');
                                       if (index <= 0 || index == hostAndPort.length()) {
                                         throw new IAE("Invalid redis cluster configuration: %s", hostAndPort);
                                       }

                                       int port;
                                       try {
                                         port = Integer.parseInt(hostAndPort.substring(index + 1));
                                       }
                                       catch (NumberFormatException e) {
                                         throw new IAE("Invalid port in %s", hostAndPort);
                                       }
                                       if (port <= 0 || port > 65535) {
                                         throw new IAE("Invalid port in %s", hostAndPort);
                                       }

                                       return new HostAndPort(hostAndPort.substring(0, index), port);
                                     }).collect(Collectors.toSet());

      ConnectionPoolConfig poolConfig = new ConnectionPoolConfig();
      poolConfig.setMaxTotal(config.getMaxTotalConnections());
      poolConfig.setMaxIdle(config.getMaxIdleConnections());
      poolConfig.setMinIdle(config.getMinIdleConnections());

      JedisCluster cluster = new JedisCluster(
          nodes,
          buildClientConfig(config, 0),
          config.getCluster().getMaxRedirection(),
          poolConfig

View on GitHub (pinned to 9b90983fd2)