{"record":{"id":"ee08b3a82e0d4930","repo":"aeron-io/aeron","slug":"low-port-value-must-be-lower-than-high-port-value","errorCode":null,"errorMessage":":low port value must be lower than high port value","messagePattern":":low port value must be lower than high port value","errorType":"validation","errorClass":"NumberFormatException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/WildcardPortManager.java","lineNumber":129,"sourceCode":"        {\n            throw new IllegalArgumentException(\"port range \\\"\" + value + \"\\\" incorrect format\");\n        }\n\n        final int[] portRange = new int[2];\n\n        try\n        {\n            portRange[0] = Integer.parseUnsignedInt(ports[0]);\n            portRange[1] = Integer.parseUnsignedInt(ports[1]);\n\n            if (portRange[0] > 65535 || portRange[1] > 65535)\n            {\n                throw new NumberFormatException(value + \":port must be an integer value between 0 and 65535\");\n            }\n\n            if (portRange[0] > portRange[1])\n            {\n                throw new NumberFormatException(value + \":low port value must be lower than high port value\");\n            }\n        }\n        catch (final NumberFormatException ex)\n        {\n            throw new IllegalArgumentException(\"invalid port value \" + value, ex);\n        }\n\n        return portRange;\n    }\n\n    private int findOpenPort()\n    {\n        for (int i = nextPort; i <= highPort; i++)\n        {\n            if (!portSet.contains(i))\n            {\n                return i;\n            }","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/WildcardPortManager.java#L111-L147","documentation":"parsePortRange also enforces ordering: after both bounds parse successfully, it requires portRange[0] <= portRange[1]. If the low bound is greater than the high bound, a NumberFormatException with this message is thrown, again wrapped by the caller into IllegalArgumentException 'invalid port value <value>'.","triggerScenarios":"Configuring a wildcard port range with reversed bounds such as '20000-10000' where the low value exceeds the high value.","commonSituations":"Hand-edited configuration files, copy-paste of ranges in descending order, or programmatically generated ranges where min/max were swapped.","solutions":["Swap the bounds so the range is 'low-high' ascending, e.g. '10000-20000'.","Normalize the range in your config loader with Math.min/Math.max before passing it in.","Validate the range at startup and fail fast with a clear message.","Equal bounds ('5000-5000') are allowed; only strictly decreasing ranges fail."],"exampleFix":"// before\nWildcardPortManager mgr = new WildcardPortManager(\"20000-10000\", ...);\n// after\nWildcardPortManager mgr = new WildcardPortManager(\"10000-20000\", ...);","handlingStrategy":"validation","validationCode":"if (low > high) throw new IllegalArgumentException(\"low must be <= high in range \" + value);","typeGuard":null,"tryCatchPattern":"try { new WildcardPortManager(value, ...); } catch (IllegalArgumentException e) { log.error(\"Invalid port range {}: {}\", value, e.getMessage()); throw new ConfigException(e); }","preventionTips":["Normalize with Math.min/Math.max when the range is computed","Keep ranges ascending in config files","Add a startup self-check that parses all port config values"],"tags":["java","aeron-driver","configuration","port-range"],"backgroundTag":"invalid-argument-value","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}