{"record":{"id":"42a53c80593de498","repo":"apache/pulsar","slug":"checkhealthyintervalms-must-be-larger-than-0","errorCode":null,"errorMessage":"checkHealthyIntervalMs must be larger than 0","messagePattern":"checkHealthyIntervalMs must be larger than 0","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/SameAuthParamsLookupAutoClusterFailover.java","lineNumber":335,"sourceCode":"        public Builder failoverThreshold(int failoverThreshold) {\n            if (failoverThreshold < 1) {\n                throw new IllegalArgumentException(\"failoverThreshold must be larger than 0\");\n            }\n            sameAuthParamsLookupAutoClusterFailover.failoverThreshold = failoverThreshold;\n            return this;\n        }\n\n        public Builder recoverThreshold(int recoverThreshold) {\n            if (recoverThreshold < 1) {\n                throw new IllegalArgumentException(\"recoverThreshold must be larger than 0\");\n            }\n            sameAuthParamsLookupAutoClusterFailover.recoverThreshold = recoverThreshold;\n            return this;\n        }\n\n        public Builder checkHealthyIntervalMs(int checkHealthyIntervalMs) {\n            if (checkHealthyIntervalMs < 1) {\n                throw new IllegalArgumentException(\"checkHealthyIntervalMs must be larger than 0\");\n            }\n            sameAuthParamsLookupAutoClusterFailover.checkHealthyIntervalMs = checkHealthyIntervalMs;\n            return this;\n        }\n\n        public Builder testTopic(String testTopic) {\n            if (StringUtils.isBlank(testTopic) && TopicName.get(testTopic) != null) {\n                throw new IllegalArgumentException(\"testTopic can not be blank\");\n            }\n            sameAuthParamsLookupAutoClusterFailover.testTopic = testTopic;\n            return this;\n        }\n\n        public Builder markTopicNotFoundAsAvailable(boolean markTopicNotFoundAsAvailable) {\n            sameAuthParamsLookupAutoClusterFailover.markTopicNotFoundAsAvailable = markTopicNotFoundAsAvailable;\n            return this;\n        }\n","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/SameAuthParamsLookupAutoClusterFailover.java#L317-L353","documentation":"The Builder.checkHealthyIntervalMs(int) setter validates that the health-probe interval is at least 1 millisecond. A zero or negative interval would cause immediate/spammed or unschedulable probes, so IllegalArgumentException is thrown.","triggerScenarios":"Calling checkHealthyIntervalMs(0) or a negative value on the SameAuthParamsLookupAutoClusterFailover Builder, e.g. when a duration config property was left unset and parsed as 0.","commonSituations":"Duration values expressed in seconds converted incorrectly (e.g. 0 seconds for 'use default'); typo in the property key so the fallback 0 is used.","solutions":["Pass a positive millisecond value (>= 1), typically thousands of ms (e.g. 30000).","Default unset/zero config values to the documented interval before calling the builder.","Sanity-check that your time-unit conversion (seconds/hours -> ms) is correct."],"exampleFix":"// before\nbuilder.checkHealthyIntervalMs((int) TimeUnit.SECONDS.toMillis(cfg.getIntervalSec())); // intervalSec=0\n\n// after\nlong ms = TimeUnit.SECONDS.toMillis(cfg.getIntervalSec() > 0 ? cfg.getIntervalSec() : 30);\nbuilder.checkHealthyIntervalMs((int) Math.max(1, ms));","handlingStrategy":"validation","validationCode":"int intervalMs = cfg.getCheckHealthyIntervalMs();\nif (intervalMs < 1) {\n    intervalMs = 30_000;\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.checkHealthyIntervalMs(ms);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Invalid checkHealthyIntervalMs, using 30000ms\", e);\n    builder.checkHealthyIntervalMs(30_000);\n}","preventionTips":["Double-check seconds-to-milliseconds conversions for interval settings.","Require interval config to be explicitly set; do not allow a silent 0 default.","Sanity-check intervals against probe timeouts (interval should exceed probe duration)."],"tags":["pulsar-client","configuration","validation","illegal-argument"],"backgroundTag":"invalid-config-value","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}