{"record":{"id":"75163dd739e5ad9c","repo":"alibaba/druid","slug":"illegal-initialsize-maxactive","errorCode":null,"errorMessage":"illegal initialSize {}, maxActive {}","messagePattern":"illegal initialSize (.+?), maxActive (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java","lineNumber":727,"sourceCode":"                    cacheServerConfigurationSet = true;\n                } else if (this.jdbcUrl.indexOf(\"cacheServerConfiguration\") != -1) {\n                    cacheServerConfigurationSet = true;\n                }\n                if (cacheServerConfigurationSet) {\n                    this.connectProperties.put(\"cacheServerConfiguration\", \"true\");\n                }\n            }\n\n            if (maxActive <= 0) {\n                throw new IllegalArgumentException(\"illegal maxActive \" + maxActive);\n            }\n\n            if (maxActive < minIdle) {\n                throw new IllegalArgumentException(\"illegal maxActive \" + maxActive);\n            }\n\n            if (getInitialSize() > maxActive) {\n                throw new IllegalArgumentException(\"illegal initialSize \" + this.initialSize + \", maxActive \" + maxActive);\n            }\n\n            if (timeBetweenLogStatsMillis > 0 && useGlobalDataSourceStat) {\n                throw new IllegalArgumentException(\"timeBetweenLogStatsMillis not support useGlobalDataSourceStat=true\");\n            }\n\n            if (maxEvictableIdleTimeMillis < minEvictableIdleTimeMillis) {\n                throw new SQLException(\"maxEvictableIdleTimeMillis must be grater than minEvictableIdleTimeMillis\");\n            }\n\n            if (keepAlive && keepAliveBetweenTimeMillis <= timeBetweenEvictionRunsMillis) {\n                throw new SQLException(\"keepAliveBetweenTimeMillis must be greater than timeBetweenEvictionRunsMillis\");\n            }\n\n            if (this.driverClass != null) {\n                this.driverClass = driverClass.trim();\n            }\n","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/alibaba/druid/blob/fa8dc9912637a2f729eef9f55356621fec18d40e/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java#L709-L745","documentation":"IllegalArgumentException thrown during init() when getInitialSize() > maxActive. initialSize controls how many connections are created eagerly at startup; creating more than the pool's maximum would immediately overflow the pool, so Druid rejects the combination.","triggerScenarios":"init() runs with this.initialSize > maxActive. The check at line 726 throws, reporting both values.","commonSituations":"initialSize set high for fast warm-up while maxActive left small; default initialSize larger than an intentionally tiny maxActive; config drift between environments.","solutions":["Set initialSize <= maxActive.","For warm-up, scale both initialSize and maxActive up together (e.g. initialSize=5, maxActive=20).","Leave initialSize at default (or 0) if you do not need eager warm-up."],"exampleFix":"# before\ndruid.initialSize=10\ndruid.maxActive=5\n# after\ndruid.initialSize=5\ndruid.maxActive=20","handlingStrategy":"validation","validationCode":"if (dataSource.getInitialSize() > dataSource.getMaxActive()) {\n    throw new IllegalStateException(\"initialSize (\" + dataSource.getInitialSize()\n        + \") must be <= maxActive (\" + dataSource.getMaxActive() + \")\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Scale initialSize with maxActive when configuring warm-up.","Leave initialSize small/default unless eager warm-up is required.","Validate the trio (maxActive, minIdle, initialSize) together."],"tags":["config","pool-sizing","init","warmup","validation"],"backgroundTag":null,"analyzedSha":"fa8dc9912637a2f729eef9f55356621fec18d40e","analyzedAt":"2026-08-14T04:55:06.789Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}