{"record":{"id":"bfc1a6e9593e0fe3","repo":"eclipse-vertx/vert.x","slug":"proxyprotocoltimeout-must-be-0","errorCode":null,"errorMessage":"proxyProtocolTimeout must be >= 0","messagePattern":"proxyProtocolTimeout must be >= 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/net/NetServerOptions.java","lineNumber":458,"sourceCode":"    return this;\n  }\n\n  /**\n   * @return the Proxy protocol timeout, in time unit specified by {@link #getProxyProtocolTimeoutUnit()}.\n   */\n  public long getProxyProtocolTimeout() {\n    return proxyProtocolTimeout;\n  }\n\n  /**\n   * Set the Proxy protocol timeout, default time unit is seconds.\n   *\n   * @param proxyProtocolTimeout the Proxy protocol timeout to set\n   * @return a reference to this, so the API can be used fluently\n   */\n  public NetServerOptions setProxyProtocolTimeout(long proxyProtocolTimeout) {\n    if (proxyProtocolTimeout < 0) {\n      throw new IllegalArgumentException(\"proxyProtocolTimeout must be >= 0\");\n    }\n    this.proxyProtocolTimeout = proxyProtocolTimeout;\n    return this;\n  }\n\n  /**\n   * Set the Proxy protocol timeout unit. If not specified, default is seconds.\n   *\n   * @param proxyProtocolTimeoutUnit specify time unit.\n   * @return a reference to this, so the API can be used fluently\n   */\n  public NetServerOptions setProxyProtocolTimeoutUnit(TimeUnit proxyProtocolTimeoutUnit) {\n    this.proxyProtocolTimeoutUnit = proxyProtocolTimeoutUnit;\n    return this;\n  }\n\n  /**\n   * @return the Proxy protocol timeout unit.","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/net/NetServerOptions.java#L440-L476","documentation":"NetServerOptions.setProxyProtocolTimeout(long) requires a non-negative timeout in milliseconds (0 typically disables it); negative values throw IllegalArgumentException. This timeout governs how long the server waits for a complete PROXY protocol header.","triggerScenarios":"Calling setProxyProtocolTimeout(-1) or lower, or a JSON config with a negative proxyProtocolTimeout processed via fromJson.","commonSituations":"Negative sentinel from config meaning 'disabled' (should be 0 instead); sign errors in computed durations; template configs left with negative defaults.","solutions":["Use 0 to disable the timeout, or a positive millisecond value","Clamp: Math.max(0, timeout) before calling","Fix the JSON config value to be >= 0"],"exampleFix":"// before\noptions.setProxyProtocolTimeout(-10);\n// after\noptions.setProxyProtocolTimeout(3000); // 3s, or 0 to disable","handlingStrategy":"validation","validationCode":"long t = configuredTimeout;\nif (t < 0) {\n  throw new IllegalArgumentException(\"proxyProtocolTimeout must be >= 0\");\n}\noptions.setProxyProtocolTimeout(t);","typeGuard":"boolean isNonNegative(long v) { return v >= 0; }","tryCatchPattern":null,"preventionTips":["Use 0 (not -1) to disable this timeout","Clamp config values with Math.max(0, value)","Keep all timeout fields in configs as non-negative milliseconds"],"tags":["validation","proxy-protocol","netserver","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"}