{"record":{"id":"462e746e5bff4a5e","repo":"eclipse-vertx/vert.x","slug":"invalid-proxy-port","errorCode":null,"errorMessage":"Invalid proxy port ","messagePattern":"Invalid proxy port ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/net/ProxyOptions.java","lineNumber":146,"sourceCode":"\n  /**\n   * Get proxy port.\n   *\n   * @return  proxy port\n   */\n  public int getPort() {\n    return port;\n  }\n\n  /**\n   * Set proxy port.\n   *\n   * @param port the proxy port to connect to\n   * @return a reference to this, so the API can be used fluently\n   */\n  public ProxyOptions setPort(int port) {\n    if (port < 0 || port > 65535) {\n      throw new IllegalArgumentException(\"Invalid proxy port \" + port);\n    }\n    this.port = port;\n    return this;\n  }\n\n  /**\n   * Get proxy username.\n   *\n   * @return  proxy username\n   */\n  public String getUsername() {\n    return username;\n  }\n\n  /**\n   * Set proxy username.\n   *\n   * @param username the proxy username","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/net/ProxyOptions.java#L128-L164","documentation":"Configuration validation in ProxyOptions.setPort: the proxy port must be within the valid range 0-65535. The offending port value is appended to the message; out-of-range ports cannot be used to reach the proxy and are rejected up front.","triggerScenarios":"Calling setPort(-1) (e.g. reusing the 'unset' convention from other options classes) or setPort(70000), or a JSON proxy config via fromJson with an out-of-range port.","commonSituations":"Reusing -1 as a 'default/unset' marker that other Vert.x setters accept; parsing 'host:port' strings where the port token is malformed; merged/partial configs supplying placeholder ports.","solutions":["Use a valid proxy port (commonly 3128, 8080, 1080)","Validate proxy configuration from JSON before constructing ProxyOptions"],"exampleFix":"// before\nnew ProxyOptions().setPort(-1); // throws\n// after\nnew ProxyOptions().setPort(3128);","handlingStrategy":"validation","validationCode":"int port = configuredProxyPort;\nif (port < 0 || port > 65535) {\n  throw new IllegalArgumentException(\"proxy port must be in 0..65535\");\n}\nproxyOptions.setPort(port);","typeGuard":"boolean isValidProxyPort(int port) { return port >= 0 && port <= 65535; }","tryCatchPattern":"try {\n  proxyOptions.setPort(port);\n} catch (IllegalArgumentException e) {\n  log.error(\"Invalid proxy port {} - expected 0..65535\", port, e);\n  throw e;\n}","preventionTips":["Do not reuse -1 as an 'unset' marker across different Vert.x setters","Validate ports when parsing host:port strings","Apply a shared 0..65535 range check to all port config fields"],"tags":["validation","proxy","port","config"],"backgroundTag":"value-out-of-range","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}