{"record":{"id":"99a9c0c6289caef2","repo":"aeron-io/aeron","slug":"paramname-newlength-does-not-match-existing-value-of","errorCode":null,"errorMessage":"${paramName}=${newLength} does not match existing value of ${existingValue}: existingChannel=${existingChannel} channel=${channel}","messagePattern":"(.+?)=(.+?) does not match existing value of (.+?): existingChannel=(.+?) channel=(.+?)","errorType":"exception","errorClass":"InvalidChannelException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java","lineNumber":2317,"sourceCode":"            for (int i = 1; i < PARTITION_COUNT; i++)\n            {\n                final int expectedTermId = (initialTermId + i) - PARTITION_COUNT;\n                initialiseTailWithTermId(logMetaData, i, expectedTermId);\n            }\n        }\n    }\n\n    private static void validateChannelBufferLength(\n        final String paramName,\n        final int newLength,\n        final int existingLength,\n        final String channel,\n        final String existingChannel)\n    {\n        if (0 != newLength && newLength != existingLength)\n        {\n            final Object existingValue = 0 == existingLength ? \"OS default\" : existingLength;\n            throw new InvalidChannelException(\n                paramName + \"=\" + newLength + \" does not match existing value of \" + existingValue +\n                    \": existingChannel=\" + existingChannel + \" channel=\" + channel);\n        }\n    }\n\n    private static void validateEndpointForPublication(final UdpChannel udpChannel)\n    {\n        if (!udpChannel.isMultiDestination() && udpChannel.hasExplicitEndpoint() &&\n            0 == udpChannel.remoteData().getPort())\n        {\n            throw new IllegalArgumentException(\n                ENDPOINT_PARAM_NAME + \" has port=0 for publication: channel=\" + udpChannel.originalUriString());\n        }\n    }\n\n    private static void validateControlForPublication(final UdpChannel udpChannel)\n    {\n        if (udpChannel.isDynamicControlMode() && !udpChannel.hasExplicitControl())","sourceCodeStart":2299,"sourceCodeEnd":2335,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java#L2299-L2335","documentation":"When a second publication or subscription reuses an existing channel endpoint, its SO_SNDBUF/SO_RCVBUF length must either be 0 (OS default) or exactly match the value already in use, because one socket is shared. This InvalidChannelException reports the mismatch between the requested param length and the existing socket buffer size.","triggerScenarios":"Adding a publication/subscription on a channel that maps to an existing endpoint but with a different term/socket-buffer length parameter, e.g. \"aeron:udp?endpoint=h:p|so-sndbuf=128k\" after \"...|so-sndbuf=64k\" exists; one URI omits the param (0 → OS default) while the other sets it.","commonSituations":"Tuning one consumer's buffer sizes without realizing the endpoint socket is shared; defaults changed in a config template for some services but not others; copying channel URIs between environments with different buffer settings.","solutions":["Use the same socket/term buffer length as the existing channel on that endpoint","Set the length to 0 (OS default) on the new channel if the existing one uses the OS default","Close the existing publications/subscriptions on that endpoint before adding with new lengths","Unify buffer-size settings in one shared configuration"],"exampleFix":"// before\naeron.addPublication(\"aeron:udp?endpoint=localhost:40456|so-sndbuf=128k\", 1001); // existing is 64k\n// after\naeron.addPublication(\"aeron:udp?endpoint=localhost:40456|so-sndbuf=64k\", 1001);","handlingStrategy":"validation","validationCode":"Long sndbuf = uriParamLong(channel, \"so-sndbuf\", 0L);\nLong existing = existingBufferLengthForEndpoint(canonicalChannel);\nif (existing != null && sndbuf != 0 && !sndbuf.equals(existing)) {\n    throw new IllegalArgumentException(\"so-sndbuf=\" + sndbuf + \" conflicts with existing \" + existing);\n}","typeGuard":null,"tryCatchPattern":"try { aeron.addPublication(channel, streamId); } catch (InvalidChannelException e) { if (e.getMessage().contains(\"does not match existing value of\")) { log.error(\"buffer length mismatch: {}\", e.getMessage()); } throw e; }","preventionTips":["Use identical socket-buffer settings for all channels sharing an endpoint","Prefer leaving buffer params unset (OS default) everywhere","Centralize tuning params in shared configuration","Re-check endpoints when changing sizes; close old publications first"],"tags":["aeron","channel-config","socket-buffer","conflict"],"backgroundTag":"conflicting-config-options","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"}