apache/dolphinscheduler · error · IllegalArgumentException
datasource host illegal
Error message
datasource host illegal
What it means
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.
Source
Thrown at dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java:74
@Override
public void checkDatasourceParam(BaseDataSourceParamDTO baseDataSourceParamDTO) {
if (!baseDataSourceParamDTO.getType().equals(DbType.REDSHIFT)) {
// due to redshift use not regular hosts
checkHost(baseDataSourceParamDTO.getHost());
}
checkDatabasePatter(baseDataSourceParamDTO.getDatabase());
checkOther(baseDataSourceParamDTO.getOther());
}
/**
* Check the host is valid
*
* @param host datasource host
*/
protected void checkHost(String host) {
if (com.google.common.net.InetAddresses.isInetAddress(host)) {
} else if (!IPV4_PATTERN.matcher(host).matches() || !IPV6_PATTERN.matcher(host).matches()) {
throw new IllegalArgumentException("datasource host illegal");
}
}
/**
* check database name is valid
*
* @param database database name
*/
protected void checkDatabasePatter(String database) {
if (!DATABASE_PATTER.matcher(database).matches()) {
throw new IllegalArgumentException("database name illegal");
}
}
/**
* check other is valid
*
* @param other otherView on GitHub (pinned to 02eac45a1b)
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
Example fix
// before
param.setHost("jdbc:mysql://1.2.3.4:3306");
// after
param.setHost("1.2.3.4");
param.setPort(3306); Defensive patterns
Strategy: validation
Validate before calling
boolean hostOk = host != null && (InetAddresses.isInetAddress(host) || host.matches("^[a-zA-Z0-9._-]+$")); Try / catch
try { processor.checkDatasourceParam(param); } catch (IllegalArgumentException e) { showFieldError("host", e.getMessage()); } Prevention
- Never paste full JDBC URLs into the host field
- Keep port in its own field
- Trim whitespace before submit
When it happens
Trigger: 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.
Common situations: Pasting a full jdbc:// URL into the host field, including the port in the host, trailing whitespace, IPv6 without brackets vs with brackets confusion.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- 1400004
- spark datasource param is not valid
- database name illegal
- datasource other params: + entry.getKey() + illegal
- address is null.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/c9d5f0b238634947.
Report an issue: GitHub.