{"record":{"id":"c6dc9b87cb150ab8","repo":"aeron-io/aeron","slug":"paramname-does-not-contain-a-valid-long-value","errorCode":null,"errorMessage":"'${paramName}' does not contain a valid long value","messagePattern":"'(.+?)' does not contain a valid long value","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java","lineNumber":341,"sourceCode":"private static Long parseOptionalLong(final ChannelUri channelUri, final String paramName)\n{\n    final String longAsString = channelUri.get(paramName);\n    if (null == longAsString)\n    {\n        return null;\n    }\n\n    try\n    {\n        return Long.valueOf(longAsString);\n    }\n    catch (final NumberFormatException ex)\n    {\n        throw new IllegalArgumentException(\"'\" + paramName + \"' does not contain a valid long value\", ex);\n    }\n}","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java#L323-L359","documentation":"Generic numeric parsing helper used when reading optional long-valued URI parameters (e.g. group-tag via groupTag()). It fetches the named parameter from the channel URI and attempts Long.valueOf. The exception fires when the parameter is present in the URI but its text cannot be parsed as a signed 64-bit long, wrapping the NumberFormatException to name the offending parameter.","triggerScenarios":"Passing group-tag=abc or a value exceeding 64-bit range in the channel URI; parseOptionalLong is invoked from groupTag parsing.","commonSituations":"Hex or decimal-prefixed strings ('0x1f') that Long.valueOf rejects, typos, or values copied from another system's format.","solutions":["Provide the group tag as a plain decimal long, e.g. group-tag=123456789","Remove the parameter if grouping is not needed","Verify no template placeholders or whitespace remain in the value"],"exampleFix":"// before\n\"aeron:udp?endpoint=...|group-tag=0x1F\"\n// after\n\"aeron:udp?endpoint=...|group-tag=31\"","handlingStrategy":"validation","validationCode":"String v = uri.getParam(\"group-tag\"); if (v != null) Long.parseLong(v.trim());","typeGuard":"static boolean isLong(String v) { try { Long.parseLong(v.trim()); return true; } catch (NumberFormatException e) { return false; } }","tryCatchPattern":"try { channel = aeron.addPublication(uri, stream); } catch (InvalidChannelException e) { if (e.getCause() instanceof NumberFormatException) { /* fix group-tag */ } throw e; }","preventionTips":["Emit group-tag as decimal long without 0x prefixes","Trim whitespace before injecting values into URIs","Validate all numeric URI params with Long.parseLong before use"],"tags":["aeron","channel-uri","numeric-parsing"],"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-15T23:17:13.987Z"}