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

ndots must be >= -1

Error message

ndots must be >= -1

What it means

Configuration validation in setNdots: the ndots threshold used when deciding whether a hostname is absolute relative to search domains must be -1 (auto-detect from the OS) or a non-negative count. Values below -1 have no defined semantics and are rejected.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/dns/AddressResolverOptions.java:492

  }

  /**
   * @return the ndots value
   */
  public int getNdots() {
    return ndots;
  }

  /**
   * Set the ndots value used when resolving using search domains, the default value is {@code -1} which
   * determines the value from the OS on Linux or uses the value {@code 1}.
   *
   * @param ndots the new ndots value
   * @return a reference to this, so the API can be used fluently
   */
  public AddressResolverOptions setNdots(int ndots) {
    if (ndots < -1) {
      throw new IllegalArgumentException("ndots must be >= -1");
    }
    this.ndots = ndots;
    return this;
  }

  /**
   * @return the value {@code true} when the dns server selection uses round robin
   */
  public boolean isRotateServers() {
    return rotateServers;
  }

  /**
   * Set to {@code true} to enable round-robin selection of the dns server to use. It spreads the query load
   * among the servers and avoids all lookup to hit the first server of the list.
   *
   * @return a reference to this, so the API can be used fluently
   */

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Pass -1 to auto-detect, or a value >= 0
  2. Validate external configuration input before applying it to AddressResolverOptions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/dns/AddressResolverOptions.java:492 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/8c7c6483cce73b4e. Report an issue: GitHub.