{"record":{"id":"f872d5abfddb1b2d","repo":"apache/seatunnel","slug":"the-server-id-range-should-be-syntax-like-5400-55","errorCode":null,"errorMessage":"The server id range should be syntax like '5400-5500', but got: ${range}","messagePattern":"The server id range should be syntax like '5400-5500', but got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/config/ServerIdRange.java","lineNumber":96,"sourceCode":"        }\n    }\n\n    /**\n     * Returns a {@link ServerIdRange} from a server id range string which likes '5400-5408' or a\n     * single server id likes '5400'.\n     */\n    public static ServerIdRange from(String range) {\n        if (range == null) {\n            long start = (new Random().nextInt(Integer.MAX_VALUE)) + 6500L;\n            // 1024000 is the maybe max number of parallelism\n            // mysql server id should be in range [1, 2^32-1]\n            long end = start + 1024000L;\n            return new ServerIdRange(start, end);\n        }\n        if (range.contains(\"-\")) {\n            String[] idArray = range.split(\"-\");\n            if (idArray.length != 2) {\n                throw new IllegalArgumentException(\n                        String.format(\n                                \"The server id range should be syntax like '5400-5500', but got: %s\",\n                                range));\n            }\n            return new ServerIdRange(\n                    parseServerId(idArray[0].trim()), parseServerId(idArray[1].trim()));\n        } else {\n            long serverId = parseServerId(range);\n            return new ServerIdRange(serverId, serverId);\n        }\n    }\n\n    private static long parseServerId(String serverIdValue) {\n        try {\n            return Long.parseLong(serverIdValue);\n        } catch (NumberFormatException e) {\n            throw new IllegalStateException(\n                    String.format(\"The server id %s is not a valid numeric.\", serverIdValue), e);","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/config/ServerIdRange.java#L78-L114","documentation":"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.","triggerScenarios":"Calling ServerIdRange.from with a range string containing more than one '-' or an otherwise unparseable form, e.g. '5400--5500' or '5400-5500-5600'.","commonSituations":"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.","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."],"exampleFix":"// before\nserver-id = 5400-5500-5600\n// after\nserver-id = 5400-5500","handlingStrategy":"validation","validationCode":"// Validate format before submitting config\nif (!rangeStr.matches(\"^\\\\d+(-\\\\d+)?$\")) {\n    throw new IllegalArgumentException(\"server-id must be 'start-end' like 5400-5500, got: \" + rangeStr);\n}","typeGuard":null,"tryCatchPattern":"try { ServerIdRange.from(value); } catch (IllegalArgumentException e) { /* correct config to single-dash range */ throw e; }","preventionTips":["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."],"tags":["configuration","parsing","server-id","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}