{"record":{"id":"d5a81f1b2bd48755","repo":"eclipse-vertx/vert.x","slug":"invalid-resolver-idle-timeout","errorCode":null,"errorMessage":"Invalid resolver idle timeout","messagePattern":"Invalid resolver idle timeout","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/impl/HttpClientBuilderInternal.java","lineNumber":123,"sourceCode":"    this.redirectHandler = handler;\n    return this;\n  }\n\n  @Override\n  public HttpClientBuilderInternal withAddressResolver(AddressResolver<?> resolver) {\n    this.addressResolver = resolver;\n    return this;\n  }\n\n  @Override\n  public HttpClientBuilderInternal withLoadBalancer(LoadBalancer loadBalancer) {\n    this.loadBalancer = loadBalancer;\n    return this;\n  }\n\n  public HttpClientBuilderInternal resolverIdleTimeout(Duration timeout) {\n    if (timeout.isNegative() || timeout.isZero()) {\n      throw new IllegalArgumentException(\"Invalid resolver idle timeout\");\n    }\n    this.resolverIdleTimeout = timeout;\n    return this;\n  }\n\n  private CloseFuture resolveCloseFuture() {\n    ContextInternal context = vertx.getContext();\n    return context != null ? context.closeFuture() : vertx.closeFuture();\n  }\n\n  private EndpointResolver endpointResolver(HttpClientConfig co) {\n    LoadBalancer _loadBalancer = loadBalancer;\n    AddressResolver<?> _addressResolver = addressResolver;\n    if (_addressResolver != null) {\n      if (_loadBalancer == null) {\n        _loadBalancer = LoadBalancer.ROUND_ROBIN;\n      }\n      return new EndpointResolverImpl<>(vertx, _addressResolver.endpointResolver(vertx), _loadBalancer, resolverIdleTimeout.toMillis());","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/impl/HttpClientBuilderInternal.java#L105-L141","documentation":"HttpClientBuilderInternal.resolverIdleTimeout validates the idle timeout Duration used to expire idle resolver results. A null-or-not, but zero or negative Duration is rejected with this IllegalArgumentException because the resolver requires a strictly positive timeout.","triggerScenarios":"Calling resolverIdleTimeout(Duration.ZERO), Duration.ofSeconds(-5), or a Duration computed from config (e.g. Duration.ofMillis(cfg.getIdle())) where the configured value is 0 or negative.","commonSituations":"Config files where idle timeout defaults to 0 meaning 'unset'; arithmetic like (timeoutA - timeoutB) producing zero/negative values; ported code from APIs where 0 meant 'disabled'.","solutions":["Pass a strictly positive Duration, e.g. Duration.ofSeconds(30).","Sanitize config-sourced values: if <= 0, fall back to a positive default before calling the builder.","If you intend 'no timeout', omit the call rather than passing zero (check the builder's default behavior)."],"exampleFix":"// before\nbuilder.resolverIdleTimeout(Duration.ofMillis(config.idleTimeoutMs())); // 0 from config\n// after\nlong ms = Math.max(config.idleTimeoutMs(), 1);\nbuilder.resolverIdleTimeout(Duration.ofMillis(ms));","handlingStrategy":"validation","validationCode":"if (timeout == null || timeout.isZero() || timeout.isNegative()) {\n  timeout = Duration.ofSeconds(30);\n}\nbuilder.resolverIdleTimeout(timeout);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sanitize config-derived durations with a positive minimum.","Remember 0 does not mean 'disabled' for this setting.","Use a shared duration-parsing helper that enforces positivity."],"tags":["configuration","duration","resolver"],"backgroundTag":"invalid-config-value","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"}