{"record":{"id":"592e32db2d2cd618","repo":"alibaba/druid","slug":"config-datasource-error","errorCode":null,"errorMessage":"Config DataSource error.","messagePattern":"Config DataSource error\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/druid/filter/config/ConfigFilter.java","lineNumber":134,"sourceCode":"\n        // 判断是否需要解密，如果需要就进行解密行动\n        boolean decrypt = isDecrypt(connectionProperties, configFileProperties);\n\n        if (configFileProperties == null) {\n            if (decrypt) {\n                decrypt(dataSource, null);\n            }\n            return;\n        }\n\n        if (decrypt) {\n            decrypt(dataSource, configFileProperties);\n        }\n\n        try {\n            DruidDataSourceFactory.config(dataSource, configFileProperties);\n        } catch (SQLException e) {\n            throw new IllegalArgumentException(\"Config DataSource error.\", e);\n        }\n    }\n\n    public boolean isDecrypt(Properties connectionProperties, Properties configFileProperties) {\n        String decrypterId = connectionProperties.getProperty(CONFIG_DECRYPT);\n        if (decrypterId == null || decrypterId.length() == 0) {\n            if (configFileProperties != null) {\n                decrypterId = configFileProperties.getProperty(CONFIG_DECRYPT);\n            }\n        }\n\n        if (decrypterId == null || decrypterId.length() == 0) {\n            decrypterId = System.getProperty(SYS_PROP_CONFIG_DECRYPT);\n        }\n\n        return Boolean.valueOf(decrypterId);\n    }\n","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/alibaba/druid/blob/fa8dc9912637a2f729eef9f55356621fec18d40e/core/src/main/java/com/alibaba/druid/filter/config/ConfigFilter.java#L116-L152","documentation":"Thrown when DruidDataSourceFactory.config(dataSource, configFileProperties) raises a SQLException while applying the properties loaded from the remote/file config to the DruidDataSource. The config step sets url, username, driver, pool sizing, etc.; a SQLException here means one of those properties was rejected (invalid value, parse failure, or a setter throwing). It is wrapped as IllegalArgumentException to fail datasource init fast.","triggerScenarios":"A valid config file was loaded (loadPropertyFromConfigFile returned non-null) but one of the applied properties is malformed - e.g. an unparseable numeric pool-sizing property, an invalid driver class, or a setter validation that throws SQLException.","commonSituations":"config.file points at a properties file with a typo (e.g. maxActive=abc), a deprecated/renamed property key, or a value that violates a setter invariant (see errors 12, 13, 14, 16).","solutions":["Read IllegalArgumentException.getCause() (the SQLException) - its message names the offending property.","Validate every key in the config file against DruidDataSourceFactory's accepted property names.","Correct or remove the offending property and reload."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate the config file's property values before init:\nProperties p = loadConfig(configFilePath);\nfor (String key : p.stringPropertyNames()) {\n    String val = p.getProperty(key);\n    // e.g. numeric checks for maxActive, initialSize, etc.\n    if (key.endsWith(\"Active\") || key.endsWith(\"Size\")) Integer.parseInt(val);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ds.setFilters(\"config\"); ds.init();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"Config DataSource error.\") && e.getCause() instanceof SQLException) {\n        // the cause names the offending property; fix config file and reload\n    }\n    throw e;\n}","preventionTips":["Validate all properties in the config file against DruidDataSourceFactory's accepted keys and types.","Version-control the config file and lint it in CI.","Apply the same value constraints documented for setters (errors 12-16)."],"tags":["config-filter","properties","configuration","datasource"],"backgroundTag":null,"analyzedSha":"fa8dc9912637a2f729eef9f55356621fec18d40e","analyzedAt":"2026-08-14T04:55:06.789Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}