eclipse-vertx/vert.x · error · java.lang.IllegalArgumentException

DNS client port ${port} must be > 0 or equal to DEFAULT_PORT

Error message

DNS client port ${port} must be > 0 or equal to DEFAULT_PORT

What it means

Configuration validation in DnsClientOptions.setPort: the DNS server port must be a valid TCP/UDP port (>= 1) or the sentinel DEFAULT_PORT constant. Any other non-positive value is rejected because the client could not connect to it.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/dns/DnsClientOptions.java:108

  }

  /**
   * Get the port to be used by this client in requests.
   *
   * @return  the port
   */
  public int getPort() {
    return port;
  }

  /**
   * Set the port to be used by this client in requests.
   *
   * @return a reference to this, so the API can be used fluently
   */
  public DnsClientOptions setPort(int port) {
    if (port<1 && port!=DEFAULT_PORT) {
      throw new IllegalArgumentException("DNS client port " + port + " must be > 0 or equal to DEFAULT_PORT");
    }
    this.port = port;
    return this;
  }

  /**
   * Get the host name to be used by this client in requests.
   *
   * @return  the host name
   */
  public String getHost() {
    return host;
  }

  /**
   * Set the host name to be used by this client in requests.
   *
   * @return a reference to this, so the API can be used fluently

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Use a valid port such as 53, or the DEFAULT_PORT sentinel
  2. Treat 0/negative values in deserialized JSON as unset and fall back to the default
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/dns/DnsClientOptions.java:108 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/4d1234a4e0366c21. Report an issue: GitHub.