{"record":{"id":"0b42aebf7fd13c40","repo":"aeron-io/aeron","slug":"invalid-port-s","errorCode":null,"errorMessage":"invalid port: <s>","messagePattern":"invalid port: <s>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/InterfaceSearchAddress.java","lineNumber":190,"sourceCode":"        {\n            throw new IllegalArgumentException(\"invalid subnet: \" + s);\n        }\n\n        final int subnetStringBegin = slashIndex + 1;\n\n        return AsciiEncoding.parseIntAscii(s, subnetStringBegin, s.length() - subnetStringBegin);\n    }\n\n    private static int getPort(\n        final String s, final int slashIndex, final int colonIndex, final int rightAngleBraceIndex)\n    {\n        if (colonIndex < 0 || rightAngleBraceIndex > colonIndex)\n        {\n            return 0;\n        }\n        else if (s.length() - 1 == colonIndex)\n        {\n            throw new IllegalArgumentException(\"invalid port: \" + s);\n        }\n\n        final int portStringBegin = colonIndex + 1;\n        final int portStringEnd = slashIndex > 0 ? slashIndex : s.length();\n\n        return AsciiEncoding.parseIntAscii(s, portStringBegin, portStringEnd - portStringBegin);\n    }\n\n    private static String getAddress(\n        final String s, final int slashIndex, final int colonIndex, final int rightAngleBraceIndex)\n    {\n        int addressEnd = s.length();\n\n        if (slashIndex >= 0)\n        {\n            addressEnd = slashIndex;\n        }\n","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/InterfaceSearchAddress.java#L172-L208","documentation":"Thrown during InterfaceSearchAddress.getPort when the string ends with a colon with no port digits after it (e.g. '10.0.0.1:'). A colon indicates a port follows, so an empty port is invalid. It surfaces via the port accessor.","triggerScenarios":"Configuring an interface search address ending in ':' such as 'localhost:' or '0.0.0.0:'.","commonSituations":"Truncated configuration strings, placeholder ports never replaced, or concatenating host+':'+port where the port variable was empty.","solutions":["Supply a concrete port after the colon (e.g. '0.0.0.0:40456') or remove the colon to use the default port of 0","Check upstream code that builds the address string to ensure the port variable is non-empty","Validate the address format with a regex or parse attempt before configuring the driver"],"exampleFix":"// before\nString addr = host + \":\" + port; // port == \"\"\n// after\nString addr = (port == null || port.isEmpty()) ? host : host + \":\" + port;","handlingStrategy":"validation","validationCode":"// reject dangling port colon before use\nstatic boolean validPortSpec(String s) {\n    int i = s.indexOf(':');\n    if (i < 0) return true;\n    int end = s.indexOf('/', i);\n    String port = s.substring(i + 1, end < 0 ? s.length() : end);\n    return !port.isEmpty() && port.chars().allMatch(Character::isDigit);\n}","typeGuard":"null","tryCatchPattern":"try {\n    addr.port();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"invalid port: \")) {\n        // treat as port 0 (ephemeral) by fixing the spec string\n    } else { throw e; }\n}","preventionTips":["Never emit 'host:' with an empty port when building spec strings dynamically","Guard the port variable with a default (e.g. 0 for ephemeral) before concatenation","Parse and validate the address string in unit tests covering your config assembly"],"tags":["validation","aeron","configuration","port"],"backgroundTag":"invalid-argument-format","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}