{"record":{"id":"c9d5f0b238634947","repo":"apache/dolphinscheduler","slug":"datasource-host-illegal","errorCode":null,"errorMessage":"datasource host illegal","messagePattern":"datasource host illegal","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java","lineNumber":74,"sourceCode":"    @Override\n    public void checkDatasourceParam(BaseDataSourceParamDTO baseDataSourceParamDTO) {\n        if (!baseDataSourceParamDTO.getType().equals(DbType.REDSHIFT)) {\n            // due to redshift use not regular hosts\n            checkHost(baseDataSourceParamDTO.getHost());\n        }\n        checkDatabasePatter(baseDataSourceParamDTO.getDatabase());\n        checkOther(baseDataSourceParamDTO.getOther());\n    }\n\n    /**\n     * Check the host is valid\n     *\n     * @param host datasource host\n     */\n    protected void checkHost(String host) {\n        if (com.google.common.net.InetAddresses.isInetAddress(host)) {\n        } else if (!IPV4_PATTERN.matcher(host).matches() || !IPV6_PATTERN.matcher(host).matches()) {\n            throw new IllegalArgumentException(\"datasource host illegal\");\n        }\n    }\n\n    /**\n     * check database name is valid\n     *\n     * @param database database name\n     */\n    protected void checkDatabasePatter(String database) {\n        if (!DATABASE_PATTER.matcher(database).matches()) {\n            throw new IllegalArgumentException(\"database name illegal\");\n        }\n    }\n\n    /**\n     * check other is valid\n     *\n     * @param other other","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java#L56-L92","documentation":"Generic validation guard in AbstractDataSourceProcessor.checkHost: it fires when the datasource host string is neither a literal IP address (Guava InetAddresses) nor matching the IPv4/IPv6 patterns — i.e. the host input at fault is a malformed hostname/address (or the check logic rejects valid hostnames, a known quirk). Called from checkDatasourceParam for all types except Redshift.","triggerScenarios":"Submitting a datasource with a host field that is not a plain IP or valid hostname/IP pattern — e.g. a full JDBC URL, 'host:port', empty string, or a hostname with illegal characters.","commonSituations":"Pasting a full jdbc:// URL into the host field, including the port in the host, trailing whitespace, IPv6 without brackets vs with brackets confusion.","solutions":["Enter only the bare host (IP or hostname) in the host field","Put the port in the separate port field","Use setHostAndPortByAddress() on the DTO to parse an address string instead of manual fields","Trim whitespace from the host value"],"exampleFix":"// before\nparam.setHost(\"jdbc:mysql://1.2.3.4:3306\");\n// after\nparam.setHost(\"1.2.3.4\");\nparam.setPort(3306);","handlingStrategy":"validation","validationCode":"boolean hostOk = host != null && (InetAddresses.isInetAddress(host) || host.matches(\"^[a-zA-Z0-9._-]+$\"));","typeGuard":null,"tryCatchPattern":"try { processor.checkDatasourceParam(param); } catch (IllegalArgumentException e) { showFieldError(\"host\", e.getMessage()); }","preventionTips":["Never paste full JDBC URLs into the host field","Keep port in its own field","Trim whitespace before submit"],"tags":["validation","datasource","hostname"],"backgroundTag":"invalid-argument-value","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}