{"record":{"id":"7b6324cf4fd7c629","repo":"brettwooldridge/HikariCP","slug":"validationtimeout-cannot-be-less-than-soft-timeo","errorCode":null,"errorMessage":"validationTimeout cannot be less than ${SOFT_TIMEOUT_FLOOR}ms","messagePattern":"validationTimeout cannot be less than (.+?)ms","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/zaxxer/hikari/HikariConfig.java","lineNumber":354,"sourceCode":"    */\n   public Credentials getCredentials()\n   {\n      return credentials.get();\n   }\n\n   /** {@inheritDoc} */\n   @Override\n   public long getValidationTimeout()\n   {\n      return validationTimeout;\n   }\n\n   /** {@inheritDoc} */\n   @Override\n   public void setValidationTimeout(long validationTimeoutMs)\n   {\n      if (validationTimeoutMs < SOFT_TIMEOUT_FLOOR) {\n         throw new IllegalArgumentException(\"validationTimeout cannot be less than \" + SOFT_TIMEOUT_FLOOR + \"ms\");\n      }\n\n      this.validationTimeout = validationTimeoutMs;\n   }\n\n   // ***********************************************************************\n   //                     All other configuration methods\n   // ***********************************************************************\n\n   /**\n    * Get the SQL query to be executed to test the validity of connections.\n    *\n    * @return the SQL query string, or null\n    */\n   public String getConnectionTestQuery()\n   {\n      return connectionTestQuery;\n   }","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/brettwooldridge/HikariCP/blob/a4d93f4f85517f90e632b795486d7102e933d7ff/src/main/java/com/zaxxer/hikari/HikariConfig.java#L336-L372","documentation":"HikariCP requires validationTimeout (how long a connection validity check may take) to be at least SOFT_TIMEOUT_FLOOR (250ms by default, via system property com.zaxxer.hikari.timeoutMs.floor). Unlike connectionTimeout there is no 0-means-infinite special case here — any value below the floor, including 0, throws IllegalArgumentException from setValidationTimeout(long). The rationale: validation queries must be given enough time to complete or healthy connections would be falsely evicted.","triggerScenarios":"Calling config.setValidationTimeout(n) with 0 <= n < 250, or setting validationTimeout in properties/yml to a sub-250ms value — commonly 1, 50, or 100 in test configurations trying to fail fast.","commonSituations":"Copying a connectionTimeout-style tuning into validationTimeout; unit tests shrinking all timeouts; misunderstanding that 0 is not the 'disabled' value for this setting (use a large value or the default 5000ms instead).","solutions":["Raise validationTimeout to >= 250ms; the default of 5000ms is fine unless you have measured validation latency","Do not try to disable validation timeout with 0 — there is no 'off' value","If your network/DB makes validation slow, fix that rather than shrinking the window"],"exampleFix":"// before\nconfig.setValidationTimeout(100); // IllegalArgumentException\n\n// after\nconfig.setValidationTimeout(5000); // default, explicit","handlingStrategy":"validation","validationCode":"long FLOOR = Long.getLong(\"com.zaxxer.hikari.timeoutMs.floor\", 250L);\nif (validationTimeoutMs < FLOOR) {\n   throw new IllegalArgumentException(\"validationTimeout must be >= \" + FLOOR + \"ms\");\n}\nconfig.setValidationTimeout(validationTimeoutMs);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember validationTimeout has no 0-means-off special case — keep it >= 250ms or leave default (5000ms)","Apply a shared 'timeout floor' clamp for all HikariCP timeouts in your config layer","Review test-config snippets that shrink every timeout uniformly"],"tags":["hikaricp","configuration","timeout","connection-pool"],"backgroundTag":null,"analyzedSha":"a4d93f4f85517f90e632b795486d7102e933d7ff","analyzedAt":"2026-08-14T12:11:37.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}