{"record":{"id":"04b30e3268254c42","repo":"aeron-io/aeron","slug":"existing-publication-has-different-spiessimulateconnection","errorCode":null,"errorMessage":"existing publication has different spiesSimulateConnection: existing=<existing> requested=<requested> existingChannel=<existingChannel> channel=<channel>","messagePattern":"existing publication has different spiesSimulateConnection: existing=<existing> requested=<requested> existingChannel=<existingChannel> channel=<channel>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java","lineNumber":368,"sourceCode":"        {\n            throw new IllegalStateException(formatMatchError(\n                TERM_OFFSET_PARAM_NAME,\n                String.valueOf(existingTermOffset),\n                String.valueOf(params.termOffset),\n                existingChannel,\n                channelUri.toString()));\n        }\n    }\n\n    static void validateSpiesSimulateConnection(\n        final PublicationParams params,\n        final boolean existingSpiesSimulateConnection,\n        final String channel,\n        final String existingChannel)\n    {\n        if (params.spiesSimulateConnection != existingSpiesSimulateConnection)\n        {\n            throw new IllegalStateException(\"existing publication has different spiesSimulateConnection: existing=\" +\n                existingSpiesSimulateConnection + \" requested=\" + params.spiesSimulateConnection +\n                \" existingChannel=\" + existingChannel + \" channel=\" + channel);\n        }\n    }\n\n    static void validateMtuForSndbuf(\n        final PublicationParams params,\n        final int channelSocketSndbufLength,\n        final MediaDriver.Context ctx,\n        final String channel,\n        final String existingChannel)\n    {\n        if (0 != channelSocketSndbufLength && params.mtuLength > channelSocketSndbufLength)\n        {\n            throw new IllegalStateException(\n                \"MTU greater than SO_SNDBUF for channel: mtu=\" + params.mtuLength +\n                \" so-sndbuf=\" + channelSocketSndbufLength +\n                (null == existingChannel ? \"\" : (\" existingChannel=\" + existingChannel)) +","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java#L350-L386","documentation":"Aeron throws this IllegalStateException when adding a publication on a channel that already has a publication (matched by channel/streamId) whose `spiesSimulateConnection` URI parameter differs from the newly requested value. Parameters of publications sharing the same network channel must be consistent, so the driver rejects the conflicting add instead of silently merging settings.","triggerScenarios":"Calling Aeron.addPublication/addExclusivePublication with a URI whose existing counterpart was added earlier with the opposite `spiesSimulateConnection=true|false` value on the same channel and stream.","commonSituations":"Mixing app code (spies enabled for testing tools like Aeron Archive replays) with config-driven code (spies disabled); changing the driver-level default between restarts while publications persist; a shared channel string constructed in two places with divergent params.","solutions":["Align the spiesSimulateConnection value in the new addPublication call with the existing publication's value shown in the message","Close the existing publication (or restart the client/driver) before adding one with different params","Centralize channel URI construction so the param is defined in one place","Verify both sides pass the same explicit value rather than relying on defaults"],"exampleFix":"// before\naeron.addPublication(\"aeron:udp?endpoint=224.0.1.1:40456|spiesSimulateConnection=false\", 1001);\naeron.addExclusivePublication(\"aeron:udp?endpoint=224.0.1.1:40456|spiesSimulateConnection=true\", 1001);\n// after\naeron.addPublication(\"aeron:udp?endpoint=224.0.1.1:40456|spiesSimulateConnection=true\", 1001);\naeron.addExclusivePublication(\"aeron:udp?endpoint=224.0.1.1:40456|spiesSimulateConnection=true\", 1001);","handlingStrategy":"validation","validationCode":"if (existingParams != null && existingParams.spiesSimulateConnection != requestedSpiesSimulateConnection) {\n    throw new IllegalArgumentException(\"spiesSimulateConnection must match existing publication on \" + channel);\n}","typeGuard":null,"tryCatchPattern":"try { publication = aeron.addPublication(uri, streamId); }\ncatch (IllegalStateException e) {\n    if (e.getMessage().contains(\"spiesSimulateConnection\")) {\n        publication = aeron.addPublication(reuseExistingChannelParams(uri), streamId);\n    } else throw e;\n}","preventionTips":["Build all channel URIs from a single shared config object","Always set spiesSimulateConnection explicitly, never rely on defaults","Reuse one ChannelUriStringBuilder per logical channel"],"tags":["aeron","configuration-conflict","messaging"],"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"}