apache/seatunnel · error · IllegalStateException

The server id ${serverIdValue} is not a valid numeric.

Error message

The server id ${serverIdValue} is not a valid numeric.

What it means

ServerIdRange.parseServerId converts each boundary of the server-id range from String to long via Long.parseLong. If a boundary is not a valid integer (letters, empty string, decimals), an IllegalStateException wrapping the NumberFormatException is thrown, stating the offending value.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/config/ServerIdRange.java:113

            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

  1. Use plain integer boundaries in the range, e.g. 5400-5500.
  2. Strip stray whitespace or quote characters from the configured value.
  3. Confirm the value is numeric end-to-end (regex ^\d+(-\d+)?$) before applying config.
  4. Remember server ids are unsigned longs in MySQL — no decimals or signs.

Example fix

// before
server-id = 5400-550O  // letter O instead of zero
// after
server-id = 5400-5500
Defensive patterns

Strategy: validation

Validate before calling

// Check numeric boundaries before parsing
for (String part : rangeStr.split("-")) {
    if (!part.trim().matches("\\d+")) {
        throw new IllegalArgumentException("Non-numeric server id boundary: " + part);
    }
}

Try / catch

try { ServerIdRange.from(value); } catch (IllegalStateException e) { /* fix the offending boundary to a plain integer */ throw e; }

Prevention

When it happens

Trigger: server-id range like '5400-abc', '54.0-5500', or '5400-' where a boundary fails Long.parseLong; also called from the single-value serverId path when the whole value is non-numeric.

Common situations: Typos ('54oo-5500'); trailing spaces around non-trimmed values in some config sources; quotes/brackets accidentally included; using an IP-like or UUID string as server id.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/037d0abb18849678. Report an issue: GitHub.