apache/seatunnel · error · IllegalArgumentException
The server id range should be syntax like '5400-5500', but g
Error message
The server id range should be syntax like '5400-5500', but got: ${range} What it means
ServerIdRange.from parses the user-supplied server-id option. A value containing '-' must split into exactly two parts (start and end); anything else — e.g. multiple dashes, malformed ranges like '5400-5500-5600' — throws an IllegalArgumentException describing the expected '5400-5500' syntax.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/config/ServerIdRange.java:96
}
}
/**
* Returns a {@link ServerIdRange} from a server id range string which likes '5400-5408' or a
* single server id likes '5400'.
*/
public static ServerIdRange from(String range) {
if (range == null) {
long start = (new Random().nextInt(Integer.MAX_VALUE)) + 6500L;
// 1024000 is the maybe max number of parallelism
// mysql server id should be in range [1, 2^32-1]
long end = start + 1024000L;
return new ServerIdRange(start, end);
}
if (range.contains("-")) {
String[] idArray = range.split("-");
if (idArray.length != 2) {
throw new IllegalArgumentException(
String.format(
"The server id range should be syntax like '5400-5500', but got: %s",
range));
}
return new ServerIdRange(
parseServerId(idArray[0].trim()), parseServerId(idArray[1].trim()));
} else {
long serverId = parseServerId(range);
return new ServerIdRange(serverId, serverId);
}
}
private static long parseServerId(String serverIdValue) {
try {
return Long.parseLong(serverIdValue);
} catch (NumberFormatException e) {
throw new IllegalStateException(
String.format("The server id %s is not a valid numeric.", serverIdValue), e);View on GitHub (pinned to cf67b549a7)
Solutions
- Rewrite the value as exactly '<start>-<end>' with a single dash, e.g. 5400-5500.
- Remove extra dashes or duplicate range segments from the config value.
- For a negative or zero start id, use a positive id range instead (MySQL server ids are unsigned).
- Validate the string with a quick regex ^\d+-\d+$ before submitting config.
Example fix
// before server-id = 5400-5500-5600 // after server-id = 5400-5500
Defensive patterns
Strategy: validation
Validate before calling
// Validate format before submitting config
if (!rangeStr.matches("^\\d+(-\\d+)?$")) {
throw new IllegalArgumentException("server-id must be 'start-end' like 5400-5500, got: " + rangeStr);
} Try / catch
try { ServerIdRange.from(value); } catch (IllegalArgumentException e) { /* correct config to single-dash range */ throw e; } Prevention
- Lint server-id values with a regex in config CI checks.
- Avoid negative or multi-segment ranges entirely.
- Document the expected '5400-5500' syntax next to the config key.
When it happens
Trigger: Calling ServerIdRange.from with a range string containing more than one '-' or an otherwise unparseable form, e.g. '5400--5500' or '5400-5500-5600'.
Common situations: Copy-paste errors in config with stray dashes; negative start values written as '-100-200' splitting into 3 parts; whitespace/typos in the seatunnel config or connector YAML.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- The server id ${serverIdValue} is not a valid numeric.
- Source offset '" + key + "' parameter value " + obj + " coul
- Subtask ID ${subTaskId} is out of server id range ${this}, p
- Invalid endpoint: ${endpoint}, expected format host:port
- prepare method is not supported
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/f872d5abfddb1b2d.
Report an issue: GitHub.