{"record":{"id":"a53dfb09b877c2f6","repo":"eclipse-vertx/vert.x","slug":"cachenegativetimetolive-must-be-0","errorCode":null,"errorMessage":"cacheNegativeTimeToLive must be >= 0","messagePattern":"cacheNegativeTimeToLive must be >= 0","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/dns/AddressResolverOptions.java","lineNumber":376,"sourceCode":"\n  /**\n   * @return the cache negative TTL in seconds\n   */\n  public int getCacheNegativeTimeToLive() {\n    return cacheNegativeTimeToLive;\n  }\n\n  /**\n   * Set the negative cache TTL value in seconds. After a failed hostname resolution, DNS queries won't be retried\n   * for a period of time equals to the negative TTL. This allows to reduce the response time of negative replies\n   * and reduce the amount of messages to DNS servers.\n   *\n   * @param cacheNegativeTimeToLive the cache negative TTL in seconds\n   * @return a reference to this, so the API can be used fluently\n   */\n  public AddressResolverOptions setCacheNegativeTimeToLive(int cacheNegativeTimeToLive) {\n    if (cacheNegativeTimeToLive < 0) {\n      throw new IllegalArgumentException(\"cacheNegativeTimeToLive must be >= 0\");\n    }\n    this.cacheNegativeTimeToLive = cacheNegativeTimeToLive;\n    return this;\n  }\n\n  /**\n   * @return the query timeout in milliseconds\n   */\n  public long getQueryTimeout() {\n    return queryTimeout;\n  }\n\n  /**\n   * Set the query timeout in milliseconds, i.e the amount of time after a query is considered to be failed.\n   *\n   * @param queryTimeout the query timeout in milliseconds\n   * @return a reference to this, so the API can be used fluently\n   */","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/dns/AddressResolverOptions.java#L358-L394","documentation":"Configuration validation in setCacheNegativeTimeToLive: the negative-cache TTL applied after failed hostname lookups must not be negative. A negative value would make no sense for the retry-suppression window, so the setter throws before assigning the field.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/dns/AddressResolverOptions.java:376 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a value >= 0 (0 disables negative caching, failed lookups are retried immediately)","Validate deserialized JSON configuration before calling the setter"],"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"}