{"record":{"id":"ac0603975d98b15a","repo":"apache/flink","slug":"invalid-port-configuration-port-range-end-must-be","errorCode":null,"errorMessage":"Invalid port configuration. Port range end must be bigger than port range start. If you wish to use single port please provide the value directly, not as a range. Given range: {}","messagePattern":"Invalid port configuration\\. Port range end must be bigger than port range start\\. If you wish to use single port please provide the value directly, not as a range\\. Given range: (.+?)","errorType":"validation","errorClass":"IllegalConfigurationException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/NetUtils.java","lineNumber":451,"sourceCode":"                // evaluate range\n                final int start = Integer.parseInt(range.substring(0, dashIdx));\n                if (!isValidHostPort(start)) {\n                    throw new IllegalConfigurationException(\n                            \"Invalid port configuration. Port must be between 0\"\n                                    + \"and 65535, but range start was \"\n                                    + start\n                                    + \".\");\n                }\n                final int end = Integer.parseInt(range.substring(dashIdx + 1));\n                if (!isValidHostPort(end)) {\n                    throw new IllegalConfigurationException(\n                            \"Invalid port configuration. Port must be between 0\"\n                                    + \"and 65535, but range end was \"\n                                    + end\n                                    + \".\");\n                }\n                if (start >= end) {\n                    throw new IllegalConfigurationException(\n                            \"Invalid port configuration.\"\n                                    + \" Port range end must be bigger than port range start.\"\n                                    + \" If you wish to use single port please provide the value directly, not as a range.\"\n                                    + \" Given range: \"\n                                    + range);\n                }\n                rangeIterator =\n                        new Iterator<Integer>() {\n                            int i = start;\n\n                            @Override\n                            public boolean hasNext() {\n                                return i <= end;\n                            }\n\n                            @Override\n                            public Integer next() {\n                                return i++;","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L433-L469","documentation":"For a 'start-end' range entry, NetUtils.getPortRangeFromString requires start < end strictly; equal or inverted bounds throw IllegalConfigurationException. The message explicitly suggests providing a single port directly instead of a one-element range. This avoids generating empty or ambiguous iterators.","triggerScenarios":"Config values like '8081-8081' (equal bounds) or '8081-8080' (inverted); parameterized configs where start and end come from the same variable.","commonSituations":"Templates defaulting both range ends to the same port; automation writing '<p>-<p>' for a fixed port; copy-paste edits flipping the two numbers.","solutions":["If you meant one port, write it without the range: '8081' not '8081-8081'.","If a range is intended, make the end strictly larger than the start.","When generating ranges from variables, add an assertion start < end before deployment."],"exampleFix":"# before\nrest.bind-port: 8081-8081\n\n# after\nrest.bind-port: 8081","handlingStrategy":"validation","validationCode":"static String normalizeRange(String def) {\n    String[] b = def.split(\"-\", 2);\n    if (b.length == 2 && b[0].equals(b[1])) return b[0]; // 'x-x' -> 'x'\n    return def;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write single ports as single ports.","When generating ranges from variables, assert start < end."],"tags":["configuration","ports","validation","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}