{"record":{"id":"4d1234a4e0366c21","repo":"eclipse-vertx/vert.x","slug":"dns-client-port-port-must-be-0-or-equal-to-de","errorCode":null,"errorMessage":"DNS client port ${port} must be > 0 or equal to DEFAULT_PORT","messagePattern":"DNS client port (.+?) must be > 0 or equal to DEFAULT_PORT","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/dns/DnsClientOptions.java","lineNumber":108,"sourceCode":"  }\n\n  /**\n   * Get the port to be used by this client in requests.\n   *\n   * @return  the port\n   */\n  public int getPort() {\n    return port;\n  }\n\n  /**\n   * Set the port to be used by this client in requests.\n   *\n   * @return a reference to this, so the API can be used fluently\n   */\n  public DnsClientOptions setPort(int port) {\n    if (port<1 && port!=DEFAULT_PORT) {\n      throw new IllegalArgumentException(\"DNS client port \" + port + \" must be > 0 or equal to DEFAULT_PORT\");\n    }\n    this.port = port;\n    return this;\n  }\n\n  /**\n   * Get the host name to be used by this client in requests.\n   *\n   * @return  the host name\n   */\n  public String getHost() {\n    return host;\n  }\n\n  /**\n   * Set the host name to be used by this client in requests.\n   *\n   * @return a reference to this, so the API can be used fluently","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/dns/DnsClientOptions.java#L90-L126","documentation":"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.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/dns/DnsClientOptions.java:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid port such as 53, or the DEFAULT_PORT sentinel","Treat 0/negative values in deserialized JSON as unset and fall back to the default"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}